-
Notifications
You must be signed in to change notification settings - Fork 64
/
FargoPlayer.cs
4641 lines (4091 loc) · 184 KB
/
FargoPlayer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using Terraria.Graphics.Capture;
using FargowiltasSouls.NPCs;
using FargowiltasSouls.Projectiles;
using ThoriumMod;
using ThoriumMod.Projectiles;
// ReSharper disable CompareOfFloatsByEqualityOperator
namespace FargowiltasSouls
{
public class FargoPlayer : ModPlayer
{
//for convenience
public bool IsStandingStill;
public float AttackSpeed;
public float wingTimeModifier;
public bool Wood;
public bool QueenStinger;
//minions
public bool BrainMinion;
public bool EaterMinion;
//pet
public bool RoombaPet;
#region enchantments
public bool PetsActive = true;
public bool ShadowEnchant;
public bool CrimsonEnchant;
public bool SpectreEnchant;
public bool BeeEnchant;
public bool SpiderEnchant;
public int SummonCrit = 20;
public bool StardustEnchant;
public bool FreezeTime = false;
private int freezeLength = 300;
public int FreezeCD = 0;
public bool MythrilEnchant;
public bool FossilEnchant;
public bool FossilBones = false;
private int boneCD = 0;
public bool JungleEnchant;
public bool ElementEnchant;
public bool ShroomEnchant;
public bool CobaltEnchant;
public int CobaltCD = 0;
public bool SpookyEnchant;
public bool HallowEnchant;
public bool ChloroEnchant;
public bool VortexEnchant;
public bool VortexStealth = false;
private int vortexCD = 0;
public bool AdamantiteEnchant;
public bool FrostEnchant;
public int IcicleCount = 0;
private int icicleCD = 0;
private Projectile[] icicles = new Projectile[3];
public bool PalladEnchant;
private int palladiumCD = 0;
public bool OriEnchant;
public bool OriSpawn = false;
public bool MeteorEnchant;
private int meteorTimer = 150;
private int meteorCD = 0;
private bool meteorShower = false;
public bool MoltenEnchant;
public bool CopperEnchant;
private int copperCD = 0;
public bool NinjaEnchant;
public bool FirstStrike;
public bool NearSmoke;
private bool hasSmokeBomb;
private int smokeBombCD;
private int smokeBombSlot;
public bool IronEnchant;
public bool IronGuard;
public bool TurtleEnchant;
public bool ShellHide;
public bool LeadEnchant;
public bool GladEnchant;
private int gladCount = 0;
public bool GoldEnchant;
public bool GoldShell;
private int goldCD = 0;
private int goldHP;
public bool CactusEnchant;
public bool ForbiddenEnchant;
public bool MinerEnchant;
public bool PumpkinEnchant;
private int pumpkinCD;
public bool SilverEnchant;
public bool PlatinumEnchant;
public bool NecroEnchant;
private int necroCD;
public bool ObsidianEnchant;
public bool TinEnchant;
public int TinCrit = 4;
public bool TikiEnchant;
public bool TikiMinion;
private int actualMinions;
public bool SolarEnchant;
public bool ShinobiEnchant;
public bool ValhallaEnchant;
public bool DarkEnchant;
private int darkCD = 0;
Vector2 prevPosition;
public bool RedEnchant;
public bool TungstenEnchant;
private float tungstenPrevSizeSave = -1;
public bool MahoganyEnchant;
public bool BorealEnchant;
public bool WoodEnchant;
public bool ShadeEnchant;
private int pearlCounter = 0;
public bool SuperBleed;
public bool CosmoForce;
public bool EarthForce;
public bool LifeForce;
public bool NatureForce;
public bool SpiritForce;
public bool ShadowForce;
public bool TerraForce;
public bool WillForce;
public bool WoodForce;
//thorium
public bool IcyEnchant;
public bool WarlockEnchant;
public bool SacredEnchant;
public bool BinderEnchant;
public bool LivingWoodEnchant;
public bool DepthEnchant;
public bool KnightEnchant;
public bool DreamEnchant;
public bool IllumiteEnchant;
public bool JesterEnchant;
public bool FolvEnchant;
public bool MalignantEnchant;
public bool WhiteDwarfEnchant;
public bool YewEnchant;
public bool CryoEnchant;
public bool TideHunterEnchant;
public bool BronzeEnchant;
public bool PlagueAcc;
public bool TideTurnerEnchant;
public bool AssassinEnchant;
public bool PyroEnchant;
public bool ThoriumEnchant;
public bool SpiritTrapperEnchant;
public bool LifeBloomEnchant;
public bool LichEnchant;
public bool DemonBloodEnchant;
public bool FeralFurEnchant;
public bool BulbEnchant;
public bool MixTape;
public bool ConduitEnchant;
public bool DragonEnchant;
public bool FleshEnchant;
public bool ThoriumSoul;
//calamity
public bool AerospecEnchant;
public bool StatigelEnchant;
public bool DaedalusEnchant;
public bool AtaxiaEnchant;
public bool MolluskEnchant;
public bool OmegaBlueEnchant;
public bool GodSlayerEnchant;
public bool SilvaEnchant;
public bool DemonShadeEnchant;
private int[] wetProj = { ProjectileID.Kraken, ProjectileID.Trident, ProjectileID.Flairon, ProjectileID.FlaironBubble, ProjectileID.WaterStream, ProjectileID.WaterBolt, ProjectileID.RainNimbus, ProjectileID.Bubble, ProjectileID.WaterGun };
//AA
#endregion
//soul effects
public bool MagicSoul;
public bool ThrowSoul;
public bool RangedSoul;
public bool RangedEssence;
public bool BuilderMode;
public bool UniverseEffect;
public bool FishSoul1;
public bool FishSoul2;
public bool TerrariaSoul;
public int HealTimer;
public int HurtTimer;
public bool Eternity;
private float eternityDamage = 0;
//maso items
public bool SlimyShield;
public bool SlimyShieldFalling;
public bool AgitatingLens;
public int AgitatingLensCD;
public bool CorruptHeart;
public int CorruptHeartCD;
public bool GuttedHeart;
public int GuttedHeartCD = 60; //should prevent spawning despite disabled toggle when loading into world
public bool NecromanticBrew;
public bool PureHeart;
public bool PungentEyeballMinion;
public bool FusedLens;
public bool GroundStick;
public bool Probes;
public bool MagicalBulb;
public bool SkullCharm;
public bool PumpkingsCape;
public bool LihzahrdTreasureBox;
public int GroundPound;
public bool BetsysHeart;
public bool BetsyDashing;
public int BetsyDashCD = 0;
public bool MutantAntibodies;
public bool GravityGlobeEX;
public bool CelestialRune;
public bool AdditionalAttacks;
public int AdditionalAttacksTimer;
public bool MoonChalice;
public bool LunarCultist;
public bool TrueEyes;
public bool CyclonicFin;
public int CyclonicFinCD;
public bool MasochistSoul;
public bool MasochistHeart;
public bool CelestialSeal;
public bool SandsofTime;
public bool DragonFang;
public bool SecurityWallet;
public bool FrigidGemstone;
public bool WretchedPouch;
public int FrigidGemstoneCD;
public bool NymphsPerfume;
public int NymphsPerfumeCD = 30;
public bool SqueakyAcc;
public bool RainbowSlime;
public bool SkeletronArms;
public bool SuperFlocko;
public bool MiniSaucer;
public bool TribalCharm;
public bool TribalAutoFire;
public bool SupremeDeathbringerFairy;
public bool GodEaterImbue;
public bool MutantSetBonus;
public bool Abominationn;
public bool PhantasmalRing;
public bool MutantsDiscountCard;
public bool MutantsPact;
public bool TwinsEX;
public bool TimsConcoction;
//debuffs
public bool Hexed;
public bool Unstable;
private int unstableCD = 0;
public bool Fused;
public bool Shadowflame;
public bool Oiled;
public bool DeathMarked;
public bool noDodge;
public bool noSupersonic;
public bool Bloodthirsty;
public bool SinisterIcon;
public bool GodEater; //defense removed, endurance removed, colossal DOT
public bool FlamesoftheUniverse; //activates various vanilla debuffs
public bool MutantNibble; //disables potions, moon bite effect, feral bite effect, disables lifesteal
public int StatLifePrevious = -1; //used for mutantNibble
public bool Asocial; //disables minions, disables pets
public bool WasAsocial;
public bool HidePetToggle0 = true;
public bool HidePetToggle1 = true;
public bool Kneecapped; //disables running :v
public bool Defenseless; //-30 defense, no damage reduction, cross necklace and knockback prevention effects disabled
public bool Purified; //purges all other buffs
public bool Infested; //weak DOT that grows exponentially stronger
public int MaxInfestTime;
public bool FirstInfection = true;
public float InfestedDust;
public bool Rotting; //inflicts DOT and almost every stat reduced
public bool SqueakyToy; //all attacks do one damage and make squeaky noises
public bool Atrophied; //melee speed and damage reduced. maybe player cannot fire melee projectiles?
public bool Jammed; //ranged damage and speed reduced, all non-custom ammo set to baseline ammos
public bool Slimed;
public byte lightningRodTimer;
public bool ReverseManaFlow;
public bool CurseoftheMoon;
public bool OceanicMaul;
public int MaxLifeReduction;
public bool Midas;
public bool MutantPresence;
public bool Swarming;
public int MasomodeCrystalTimer = 0;
public int MasomodeFreezeTimer = 0;
public int MasomodeSpaceBreathTimer = 0;
public IList<string> disabledSouls = new List<string>();
private readonly Mod thorium = ModLoader.GetMod("ThoriumMod");
private Mod dbzMod = ModLoader.GetMod("DBZMOD");
public override TagCompound Save()
{
//idk ech
string name = "FargoDisabledSouls" + player.name;
var FargoDisabledSouls = new List<string>();
if (CelestialSeal) FargoDisabledSouls.Add("CelestialSeal");
if (MutantsDiscountCard) FargoDisabledSouls.Add("MutantsDiscountCard");
if (MutantsPact) FargoDisabledSouls.Add("MutantsPact");
return new TagCompound {
{name, FargoDisabledSouls}
}; ;
}
public override void Load(TagCompound tag)
{
string name = "FargoDisabledSouls" + player.name;
//string log = name + " loaded: ";
disabledSouls = tag.GetList<string>(name);
CelestialSeal = disabledSouls.Contains("CelestialSeal");
MutantsDiscountCard = disabledSouls.Contains("MutantsDiscountCard");
MutantsPact = disabledSouls.Contains("MutantsPact");
}
public override void OnEnterWorld(Player player)
{
disabledSouls.Clear();
for (int i = 0; i < 200; i++)
{
if (Main.npc[i].type == NPCID.LunarTowerSolar
|| Main.npc[i].type == NPCID.LunarTowerVortex
|| Main.npc[i].type == NPCID.LunarTowerNebula
|| Main.npc[i].type == NPCID.LunarTowerStardust)
{
if (Main.netMode == 1)
{
var netMessage = mod.GetPacket();
netMessage.Write((byte)1);
netMessage.Write((byte)i);
netMessage.Send();
Main.npc[i].lifeMax *= 3;
}
else
{
Main.npc[i].GetGlobalNPC<FargoSoulsGlobalNPC>().SetDefaults(Main.npc[i]);
Main.npc[i].life = Main.npc[i].lifeMax;
}
}
}
}
public override void ProcessTriggers(TriggersSet triggersSet)
{
if(Fargowiltas.FreezeKey.JustPressed && StardustEnchant && FreezeCD == 0)
{
FreezeTime = true;
FreezeCD = 3600;
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/ZaWarudo").WithVolume(1f).WithPitchVariance(.5f), player.Center);
}
if (Fargowiltas.GoldKey.JustPressed && GoldEnchant && goldCD == 0)
{
player.AddBuff(mod.BuffType("GoldenStasis"), 600);
goldCD = 3600;
goldHP = player.statLife;
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Zhonyas").WithVolume(1f), player.Center);
}
if (Fargowiltas.SmokeBombKey.JustPressed && NinjaEnchant && hasSmokeBomb && smokeBombCD == 0 && player.controlUseItem == false && player.itemAnimation == 0 && player.itemTime == 0)
{
Vector2 velocity = Vector2.Normalize(Main.MouseWorld - player.Center) * 6;
Projectile.NewProjectile(player.Center, velocity, ProjectileID.SmokeBomb, 0, 0, player.whoAmI);
smokeBombCD = 15;
player.inventory[smokeBombSlot].stack--;
}
if (Fargowiltas.BetsyDashKey.JustPressed && BetsysHeart && BetsyDashCD <= 0)
{
BetsyDashCD = 120;
if (player.whoAmI == Main.myPlayer)
{
player.controlLeft = false;
player.controlRight = false;
player.controlJump = false;
player.controlDown = false;
player.controlUseItem = false;
player.controlUseTile = false;
player.controlHook = false;
player.controlMount = false;
player.immune = true;
player.immuneTime = 2;
player.hurtCooldowns[0] = 2;
player.hurtCooldowns[1] = 2;
player.itemAnimation = 0;
player.itemTime = 0;
Vector2 vel = player.DirectionTo(Main.MouseWorld) * (MasochistHeart ? 25 : 20);
Projectile.NewProjectile(player.Center, vel, mod.ProjectileType("BetsyDash"), (int)(100 * player.meleeDamage), 0f, player.whoAmI);
player.AddBuff(mod.BuffType("BetsyDash"), 20);
}
}
}
public override void ResetEffects()
{
if (CelestialSeal)
{
player.extraAccessory = true;
player.extraAccessorySlots = 2;
}
AttackSpeed = 1f;
Wood = false;
wingTimeModifier = 1f;
QueenStinger = false;
BrainMinion = false;
EaterMinion = false;
RoombaPet = false;
#region enchantments
PetsActive = true;
ShadowEnchant = false;
CrimsonEnchant = false;
SpectreEnchant = false;
BeeEnchant = false;
SpiderEnchant = false;
StardustEnchant = false;
MythrilEnchant = false;
FossilEnchant = false;
JungleEnchant = false;
ElementEnchant = false;
ShroomEnchant = false;
CobaltEnchant = false;
SpookyEnchant = false;
HallowEnchant = false;
ChloroEnchant = false;
VortexEnchant = false;
AdamantiteEnchant = false;
FrostEnchant = false;
PalladEnchant = false;
OriEnchant = false;
MeteorEnchant = false;
MoltenEnchant = false;
CopperEnchant = false;
NinjaEnchant = false;
FirstStrike = false;
NearSmoke = false;
hasSmokeBomb = false;
IronEnchant = false;
IronGuard = false;
TurtleEnchant = false;
ShellHide = false;
LeadEnchant = false;
GladEnchant = false;
GoldEnchant = false;
GoldShell = false;
CactusEnchant = false;
ForbiddenEnchant = false;
MinerEnchant = false;
PumpkinEnchant = false;
SilverEnchant = false;
PlatinumEnchant = false;
NecroEnchant = false;
ObsidianEnchant = false;
TinEnchant = false;
TikiEnchant = false;
TikiMinion = false;
SolarEnchant = false;
ShinobiEnchant = false;
ValhallaEnchant = false;
DarkEnchant = false;
RedEnchant = false;
TungstenEnchant = false;
MahoganyEnchant = false;
BorealEnchant = false;
WoodEnchant = false;
ShadeEnchant = false;
SuperBleed = false;
CosmoForce = false;
EarthForce = false;
LifeForce = false;
NatureForce = false;
SpiritForce = false;
TerraForce = false;
ShadowForce = false;
WillForce = false;
WoodForce = false;
//thorium
IcyEnchant = false;
WarlockEnchant = false;
SacredEnchant = false;
BinderEnchant = false;
LivingWoodEnchant = false;
DepthEnchant = false;
KnightEnchant = false;
DreamEnchant = false;
IllumiteEnchant = false;
JesterEnchant = false;
FolvEnchant = false;
MalignantEnchant = false;
WhiteDwarfEnchant = false;
YewEnchant = false;
CryoEnchant = false;
TideHunterEnchant = false;
BronzeEnchant = false;
PlagueAcc = false;
TideTurnerEnchant = false;
AssassinEnchant = false;
PyroEnchant = false;
ThoriumEnchant = false;
SpiritTrapperEnchant = false;
LifeBloomEnchant = false;
LichEnchant = false;
DemonBloodEnchant = false;
FeralFurEnchant = false;
BulbEnchant = false;
MixTape = false;
ConduitEnchant = false;
DragonEnchant = false;
FleshEnchant = false;
ThoriumSoul = false;
//calamity
AerospecEnchant = false;
StatigelEnchant = false;
DaedalusEnchant = false;
AtaxiaEnchant = false;
MolluskEnchant = false;
OmegaBlueEnchant = false;
GodSlayerEnchant = false;
SilvaEnchant = false;
DemonShadeEnchant = false;
#endregion
//souls
MagicSoul = false;
ThrowSoul = false;
RangedSoul = false;
RangedEssence = false;
BuilderMode = false;
UniverseEffect = false;
FishSoul1 = false;
FishSoul2 = false;
TerrariaSoul = false;
Eternity = false;
//maso
SlimyShield = false;
AgitatingLens = false;
CorruptHeart = false;
GuttedHeart = false;
NecromanticBrew = false;
PureHeart = false;
PungentEyeballMinion = false;
FusedLens = false;
GroundStick = false;
Probes = false;
MagicalBulb = false;
SkullCharm = false;
PumpkingsCape = false;
LihzahrdTreasureBox = false;
BetsysHeart = false;
BetsyDashing = false;
MutantAntibodies = false;
GravityGlobeEX = false;
CelestialRune = false;
AdditionalAttacks = false;
MoonChalice = false;
LunarCultist = false;
TrueEyes = false;
CyclonicFin = false;
MasochistSoul = false;
MasochistHeart = false;
SandsofTime = false;
DragonFang = false;
SecurityWallet = false;
FrigidGemstone = false;
WretchedPouch = false;
NymphsPerfume = false;
SqueakyAcc = false;
RainbowSlime = false;
SkeletronArms = false;
SuperFlocko = false;
MiniSaucer = false;
TribalCharm = false;
SupremeDeathbringerFairy = false;
GodEaterImbue = false;
MutantSetBonus = false;
Abominationn = false;
PhantasmalRing = false;
TwinsEX = false;
TimsConcoction = false;
//debuffs
Hexed = false;
Unstable = false;
Fused = false;
Shadowflame = false;
Oiled = false;
Slimed = false;
noDodge = false;
noSupersonic = false;
Bloodthirsty = false;
SinisterIcon = false;
GodEater = false;
FlamesoftheUniverse = false;
MutantNibble = false;
Asocial = false;
Kneecapped = false;
Defenseless = false;
Purified = false;
Infested = false;
Rotting = false;
SqueakyToy = false;
Atrophied = false;
Jammed = false;
ReverseManaFlow = false;
CurseoftheMoon = false;
OceanicMaul = false;
DeathMarked = false;
Midas = false;
MutantPresence = false;
Swarming = false;
}
public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
{
if (Eternity)
player.respawnTimer = (int)(player.respawnTimer * .1);
else if (SandsofTime && !FargoSoulsGlobalNPC.AnyBossAlive())
player.respawnTimer = (int)(player.respawnTimer * .5);
}
public override void UpdateDead()
{
wingTimeModifier = 1f;
//debuffs
Hexed = false;
Unstable = false;
unstableCD = 0;
Fused = false;
Shadowflame = false;
Oiled = false;
Slimed = false;
noDodge = false;
noSupersonic = false;
lightningRodTimer = 0;
BuilderMode = false;
SlimyShieldFalling = false;
CorruptHeartCD = 60;
GuttedHeartCD = 60;
NecromanticBrew = false;
GroundPound = 0;
NymphsPerfume = false;
NymphsPerfumeCD = 30;
PungentEyeballMinion = false;
MagicalBulb = false;
LunarCultist = false;
TrueEyes = false;
BetsyDashing = false;
GodEater = false;
FlamesoftheUniverse = false;
MutantNibble = false;
Asocial = false;
Kneecapped = false;
Defenseless = false;
Purified = false;
Infested = false;
Rotting = false;
SqueakyToy = false;
Atrophied = false;
Jammed = false;
CurseoftheMoon = false;
OceanicMaul = false;
DeathMarked = false;
Midas = false;
SuperBleed = false;
Bloodthirsty = false;
SinisterIcon = false;
MaxLifeReduction = 0;
}
public override void PreUpdate()
{
if (HurtTimer > 0)
HurtTimer--;
IsStandingStill = Math.Abs(player.velocity.X) < 0.05 && Math.Abs(player.velocity.Y) < 0.05;
player.npcTypeNoAggro[0] = true;
if (FargoSoulsWorld.MasochistMode)
{
//falling gives you dazed. wings save you
if (player.velocity.Y == 0f && player.wingsLogic == 0 && !player.noFallDmg)
{
int num21 = 25;
num21 += player.extraFall;
int num22 = (int)(player.position.Y / 16f) - player.fallStart;
if (player.mount.CanFly)
{
num22 = 0;
}
if (player.mount.Cart && Minecart.OnTrack(player.position, player.width, player.height))
{
num22 = 0;
}
if (player.mount.Type == 1)
{
num22 = 0;
}
player.mount.FatigueRecovery();
if (((player.gravDir == 1f && num22 > num21) || (player.gravDir == -1f && num22 < -num21)))
{
player.immune = false;
int dmg = (int)(num22 * player.gravDir - num21) * 10;
if (player.mount.Active)
dmg = (int)(dmg * player.mount.FallDamage);
player.Hurt(PlayerDeathReason.ByOther(0), dmg, 0);
player.AddBuff(BuffID.Dazed, 120);
}
player.fallStart = (int)(player.position.Y / 16f);
}
if (player.ZoneUnderworldHeight)
{
if (!(player.fireWalk || PureHeart))
player.AddBuff(BuffID.OnFire, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
}
if (player.ZoneJungle && player.wet && !MutantAntibodies)
player.AddBuff(BuffID.Poisoned, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
if (player.ZoneSnow)
{
//if (!PureHeart && !Main.dayTime && Framing.GetTileSafely(player.Center).wall == WallID.None)
// player.AddBuff(BuffID.Chilled, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
if (player.wet && !MutantAntibodies)
{
//player.AddBuff(BuffID.Frostburn, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
MasomodeFreezeTimer++;
if (MasomodeFreezeTimer >= 600)
{
player.AddBuff(BuffID.Frozen, Main.expertMode && Main.expertDebuffTime > 1 ? 60 : 120);
MasomodeFreezeTimer = -300;
}
}
else
{
MasomodeFreezeTimer = 0;
}
}
else
{
MasomodeFreezeTimer = 0;
}
/*if (player.wet && !MutantAntibodies)
{
if (player.ZoneDesert)
player.AddBuff(BuffID.Slow, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
if (player.ZoneDungeon)
player.AddBuff(BuffID.Cursed, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
Tile currentTile = Framing.GetTileSafely(player.Center);
if (currentTile.wall == WallID.GraniteUnsafe)
player.AddBuff(BuffID.Weak, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
if (currentTile.wall == WallID.MarbleUnsafe)
player.AddBuff(BuffID.BrokenArmor, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
}*/
if (player.ZoneCorrupt)
{
if (!PureHeart)
player.AddBuff(BuffID.Darkness, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
if(player.wet && !MutantAntibodies)
player.AddBuff(BuffID.CursedInferno, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
}
if (player.ZoneCrimson)
{
if (!PureHeart)
player.AddBuff(BuffID.Bleeding, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
if (player.wet && !MutantAntibodies)
player.AddBuff(BuffID.Ichor, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
}
if (player.ZoneHoly && (player.ZoneRockLayerHeight || player.ZoneDirtLayerHeight) && player.active)
{
if (!PureHeart)
player.AddBuff(mod.BuffType("FlippedHallow"), 120);
if (player.wet && !MutantAntibodies)
player.AddBuff(BuffID.Confused, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
}
if (!PureHeart && Main.raining && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && player.HeldItem.type != ItemID.Umbrella)
{
Tile currentTile = Framing.GetTileSafely(player.Center);
if (currentTile.wall == WallID.None)
{
if (player.ZoneSnow)
player.AddBuff(BuffID.Chilled, Main.expertMode && Main.expertDebuffTime > 1 ? 1 : 2);
else
player.AddBuff(BuffID.Wet, 2);
/*if (Main.hardMode)
{
lightningCounter++;
if (lightningCounter >= 600)
{
//tends to spawn in ceilings if the player goes indoors/underground
Point tileCoordinates = player.Top.ToTileCoordinates();
tileCoordinates.X += Main.rand.Next(-25, 25);
tileCoordinates.Y -= 15 + Main.rand.Next(-5, 5);
for (int index = 0; index < 10 && !WorldGen.SolidTile(tileCoordinates.X, tileCoordinates.Y) && tileCoordinates.Y > 10; ++index) tileCoordinates.Y -= 1;
Projectile.NewProjectile(tileCoordinates.X * 16 + 8, tileCoordinates.Y * 16 + 17, 0f, 0f, ProjectileID.VortexVortexLightning, 0, 2f, Main.myPlayer,
0f, 0f);
lightningCounter = 0;
}
}*/
}
}
if (player.wet && !(player.accFlipper || player.gills || MutantAntibodies))
player.AddBuff(mod.BuffType("Lethargic"), 2);
if (!PureHeart && !player.buffImmune[BuffID.Suffocation] && player.ZoneSkyHeight && player.whoAmI == Main.myPlayer)
{
bool inLiquid = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir);
if (!inLiquid || !player.gills)
{
player.breath -= 3;
if (++MasomodeSpaceBreathTimer > 10)
{
MasomodeSpaceBreathTimer = 0;
player.breath--;
}
if (player.breath == 0)
Main.PlaySound(23);
if (player.breath <= 0)
player.AddBuff(BuffID.Suffocation, 2);
}
}
if (!PureHeart && !player.buffImmune[BuffID.Webbed] && player.stickyBreak > 0)
{
Vector2 tileCenter = player.Center;
tileCenter.X /= 16;
tileCenter.Y /= 16;
Tile currentTile = Framing.GetTileSafely((int)tileCenter.X, (int)tileCenter.Y);
if (currentTile != null && currentTile.wall == WallID.SpiderUnsafe)
{
player.AddBuff(BuffID.Webbed, 30);
player.stickyBreak = 0;
Vector2 vector = Collision.StickyTiles(player.position, player.velocity, player.width, player.height);
if (vector.X != -1 && vector.Y != -1)
{
int num3 = (int)vector.X;
int num4 = (int)vector.Y;
WorldGen.KillTile(num3, num4, false, false, false);
if (Main.netMode == 1 && !Main.tile[num3, num4].active())
NetMessage.SendData(17, -1, -1, null, 0, num3, num4, 0f, 0, 0, 0);
}
}
}
if (!PureHeart && Main.bloodMoon)
player.AddBuff(BuffID.WaterCandle, 2);
if (!SandsofTime)
{
Vector2 tileCenter = player.Center;
tileCenter.X /= 16;
tileCenter.Y /= 16;
Tile currentTile = Framing.GetTileSafely((int)tileCenter.X, (int)tileCenter.Y);
if (currentTile != null && currentTile.type == TileID.Cactus && currentTile.nactive())
{
int damage = 20;
if (player.ZoneCorrupt || player.ZoneCrimson || player.ZoneHoly)
{
damage = 40;
player.AddBuff(BuffID.Poisoned, Main.expertMode && Main.expertDebuffTime > 1 ? 150 : 300);
}
if (player.hurtCooldowns[0] <= 0) //same i-frames as spike tiles
player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was pricked by a Cactus."), damage, 0, false, false, false, 0);
}
}
if (MasomodeCrystalTimer > 0)
MasomodeCrystalTimer--;
}
if (!Infested && !FirstInfection)
FirstInfection = true;
if (Eternity && TinCrit < 50)
TinCrit = 50;
else if(TerrariaSoul && TinCrit < 25)
TinCrit = 25;
else if (TerraForce && TinCrit < 10)
TinCrit = 10;
if(OriSpawn && !OriEnchant)
OriSpawn = false;
if (VortexStealth && !VortexEnchant)
VortexStealth = false;
if (Unstable)
{
if (unstableCD == 0)
{
Vector2 pos = player.position;
int x = Main.rand.Next((int)pos.X - 500, (int)pos.X + 500);
int y = Main.rand.Next((int)pos.Y - 500, (int)pos.Y + 500);
Vector2 teleportPos = new Vector2(x, y);
while (Collision.SolidCollision(teleportPos, player.width, player.height) && teleportPos.X > 50 && teleportPos.X < (double)(Main.maxTilesX * 16 - 50) && teleportPos.Y > 50 && teleportPos.Y < (double)(Main.maxTilesY * 16 - 50))
{
x = Main.rand.Next((int)pos.X - 500, (int)pos.X + 500);
y = Main.rand.Next((int)pos.Y - 500, (int)pos.Y + 500);
teleportPos = new Vector2(x, y);
}
player.Teleport(teleportPos, 1);
NetMessage.SendData(65, -1, -1, null, 0, player.whoAmI, teleportPos.X, teleportPos.Y, 1);
unstableCD = 60;
}
unstableCD--;
}
if (SuperBleed && Main.rand.Next(4) == 0)
{
Projectile.NewProjectile(player.position.X + Main.rand.Next(player.width), player.Center.Y + Main.rand.Next(player.height),
0f + Main.rand.Next(-5, 5), Main.rand.Next(-6, -2), mod.ProjectileType("SuperBlood"), 5, 0f, Main.myPlayer);
}
if (CopperEnchant && copperCD > 0)
copperCD--;
if (GoldEnchant && goldCD > 0)
goldCD--;
if (GoldShell)
{