-
Notifications
You must be signed in to change notification settings - Fork 3
/
MyPlayer.cs
3077 lines (2843 loc) · 100 KB
/
MyPlayer.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 System.Text;
using System.IO;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader.IO;
using Terraria.GameInput;
using SpiritMod.NPCs;
using SpiritMod.Mounts;
namespace SpiritMod
{
public class MyPlayer : ModPlayer
{
public bool ZoneAsteroid = false;
public const int CAMO_DELAY = 100;
public int Soldiers = 0;
internal static bool swingingCheck;
internal static Item swingingItem;
public bool TormentLantern = false;
public bool QuacklingMinion = false;
public bool VampireCloak = false;
public bool HealCloak = false;
public bool SpiritCloak = false;
public bool firewall = false;
private int Counter;
private int timerz;
public bool caltfist = false;
public bool ZoneBlueMoon = false;
private int timer1;
public bool astralSet = false;
public bool SoulStone = false;
public bool geodeSet = false;
public bool ToxicExtract = false;
public bool sunStone = false;
public bool moonStone = false;
public bool animusLens = false;
public bool timScroll = false;
public bool cultistScarf = false;
public bool fateToken = false;
public bool geodeRanged = false;
public bool atmos = false;
public bool fireMaw = false;
public bool deathRose = false;
public bool anglure = false;
public bool Fierysoul = false;
public bool manaWings = false;
public bool infernalFlame = false;
public bool crystal = false;
public bool eyezorEye = false;
public bool shamanBand = false;
public bool ChaosCrystal = false;
public bool wheezeScale = false;
public bool briarHeart = false;
public bool winterbornCharmMage = false;
public bool HellGaze = false;
public bool hungryMinion = false;
public bool magazine = false;
public bool EaterSummon = false;
public bool CreeperSummon = false;
public bool CrystalShield = false;
public bool moonHeart = false;
public bool babyClampers = false;
public bool Phantom = false;
public bool gremlinTooth = false;
public bool sacredVine = false;
public bool BlueDust = false;
public bool onGround = false;
public bool moving = false;
public bool flying = false;
public bool swimming = false;
public bool copterBrake = false;
public bool copterFiring = false;
public int copterFireFrame = 1000;
public int beetleStacks = 1;
public int shootDelay = 0;
public int shootDelay1 = 0;
public int shootDelay2 = 0;
public int shootDelay3 = 0;
public bool unboundSoulMinion = false;
public bool cragboundMinion = false;
public bool crawlerockMinion = false;
public bool pigronMinion = false;
public bool terror1Summon = false;
public bool terror2Summon = false;
public bool terror3Summon = false;
public bool terror4Summon = false;
public bool minior = false;
public bool cthulhuMinion = false;
public double pressedSpecial;
float DistYT = 0f;
float DistXT = 0f;
float DistY = 0f;
float DistX = 0f;
public Entity LastEnemyHit = null;
public bool TiteRing = false;
public bool NebulaPearl = false;
public bool CursedPendant = false;
public bool IchorPendant = false;
public bool KingRock = false;
public bool spiritNecklace = false;
private bool loaded = false;
public bool starMap = false;
private const int saveVersion = 0;
public bool minionName = false;
public bool Ward = false;
public bool Ward1 = false;
public static bool hasProjectile;
public bool DoomDestiny = false;
public int HitNumber;
public bool ZoneSpirit = false;
public bool ZoneReach = false;
public int PutridHits = 0;
public int Rangedhits = 0;
public bool flametrail = false;
public bool icytrail = false;
public bool EnchantedPaladinsHammerMinion = false;
public bool ProbeMinion = false;
public int weaponAnimationCounter;
public int hexBowAnimationFrame;
public bool carnivorousPlantMinion = false;
public bool skeletalonMinion = false;
public bool babyClamper = false;
public bool beetleMinion = false;
public bool steamMinion = false;
public bool aeonMinion = false;
public bool lihzahrdMinion = false;
public bool SnakeMinion = false;
public bool Ghast = false;
public bool DungeonSummon = false;
public bool ReachSummon = false;
public bool gasopodMinion = false;
public bool tankMinion = false;
public bool OG = false;
public bool Flayer = false;
public int soulSiphon;
public bool maskPet = false;
public bool lanternPet = false;
public bool thrallPet = false;
public bool jellyfishPet = false;
public bool starPet = false;
public bool saucerPet = false;
public bool bookPet = false;
public bool SwordPet = false;
public bool shadowPet = false;
public float SpeedMPH
{ get; private set; }
private DashType activeDash;
public DashType ActiveDash => activeDash;
public GlyphType glyph;
public int voidStacks = 1;
public int camoCounter;
public int veilCounter;
public bool blazeBurn;
public int phaseCounter;
public int phaseStacks;
public bool phaseShift;
private float[] phaseSlice = new float[60];
public int divineCounter;
public int divineStacks = 1;
public int stormStacks;
public int frostCooldown;
public float frostRotation;
public bool frostUpdate;
public int frostTally;
public int frostCount;
// Armor set booleans.
public bool duskSet;
public bool runicSet;
public bool icySet;
public bool depthSet;
public bool primalSet;
public bool spiritSet;
public bool putridSet;
public bool illuminantSet;
public bool duneSet;
public bool lihzahrdSet;
public bool acidSet;
public bool reachSet;
public bool leatherSet;
public bool witherSet;
public bool titanicSet;
public bool reaperSet;
public bool shadowSet;
public bool oceanSet;
public bool windSet;
public bool cometSet;
public bool hellSet;
public bool bloodfireSet;
public bool quickSilverSet;
public bool reaperMask;
public bool magicshadowSet;
public bool cryoSet;
public bool frigidSet;
public bool rangedshadowSet;
public bool meleeshadowSet;
public bool infernalSet;
public bool crystalSet;
public bool bloomwindSet;
public bool fierySet;
public bool starSet;
public bool magalaSet;
public bool thermalSet;
public bool veinstoneSet;
public bool clatterboneSet;
public bool ichorSet1;
public bool ichorSet2;
public bool talonSet;
public bool OverseerCharm = false;
public bool Bauble = false;
// Accessory booleans.
public bool OriRing;
public bool SRingOn;
public bool goldenApple;
public bool hpRegenRing;
public bool bubbleShield;
public bool icySoul;
public bool mythrilCharm;
public bool infernalShield;
public bool shadowGauntlet;
public bool KingSlayerFlask;
public bool Resolve;
public bool DarkBough;
public bool MoonSongBlossom;
public bool HolyGrail;
public bool moonGauntlet;
public bool starCharm;
public int timeLeft = 0;
int timer = 0;
public int infernalHit;
public int infernalDash;
public int infernalSetCooldown;
public int firewallHit;
public int bubbleTimer;
public int clatterboneTimer;
public int roseTimer;
public int baubleTimer;
public int cometTimer;
public bool concentrated; // For the leather armor set.
public int concentratedCooldown;
public bool basiliskMount;
public bool drakomireMount;
public int drakomireFlameTimer;
public bool drakinMount;
public bool toxify;
public bool acidImbue;
public bool spiritBuff;
public bool starBuff;
public bool runeBuff;
public bool poisonPotion;
public bool soulPotion;
public bool gremlinBuff;
public int candyInBowl;
private IList<string> candyFromTown= new List<string>();
public override void UpdateBiomeVisuals()
{
player.ManageSpecialBiomeVisuals("SpiritMod:BlueMoonSky", ZoneBlueMoon, player.Center);
player.ManageSpecialBiomeVisuals("SpiritMod:SpiritSky", ZoneSpirit, player.Center);
bool useFire = NPC.AnyNPCs(mod.NPCType("Overseer"));
player.ManageSpecialBiomeVisuals("SpiritMod:Overseer", useFire);
bool useFire2 = NPC.AnyNPCs(mod.NPCType("IlluminantMaster"));
player.ManageSpecialBiomeVisuals("SpiritMod:IlluminantMaster", useFire2);
bool useRock = NPC.AnyNPCs(mod.NPCType("Atlas"));
player.ManageSpecialBiomeVisuals("SpiritMod:Atlas", useRock);
player.ManageSpecialBiomeVisuals("SpiritMod:AsteroidSky", ZoneAsteroid, player.Center);
}
public override void UpdateBiomes()
{
ZoneSpirit = MyWorld.SpiritTiles > 100;
ZoneBlueMoon = MyWorld.BlueMoon;
ZoneReach = MyWorld.ReachTiles > 150;
ZoneAsteroid = (MyWorld.AsteroidTiles > 400);
}
public override bool CustomBiomesMatch(Player other)
{
MyPlayer modOther = other.GetModPlayer<MyPlayer>(mod);
return ZoneSpirit == modOther.ZoneSpirit && ZoneReach == modOther.ZoneReach;
}
public override void CopyCustomBiomesTo(Player other)
{
MyPlayer modOther = other.GetModPlayer<MyPlayer>(mod);
modOther.ZoneSpirit = ZoneSpirit;
modOther.ZoneReach = ZoneReach;
}
public override void SendCustomBiomes(BinaryWriter writer)
{
byte flags = 0;
if (ZoneSpirit)
flags |= 1;
if (ZoneReach)
flags |= 2;
writer.Write(flags);
}
public override void ReceiveCustomBiomes(BinaryReader reader)
{
byte flags = reader.ReadByte();
ZoneSpirit = ((flags & 1) == 1);
ZoneReach = ((flags & 2) == 2);
}
public override TagCompound Save()
{
TagCompound tag = new TagCompound();
tag.Add("candyInBowl", candyInBowl);
tag.Add("candyFromTown", candyFromTown);
return tag;
}
public override void Load(TagCompound tag)
{
candyInBowl = tag.GetInt("candyInBowl");
candyFromTown = tag.GetList<string>("candyFromTown");
}
public override void ResetEffects()
{
caltfist = false;
firewall = false;
TormentLantern = false;
QuacklingMinion = false;
VampireCloak = false;
SpiritCloak = false;
HealCloak = false;
astralSet = false;
ChaosCrystal = false;
ToxicExtract = false;
cultistScarf = false;
moonHeart = false;
Fierysoul = false;
infernalFlame = false;
gremlinTooth = false;
atmos = false;
SoulStone = false;
anglure = false;
geodeSet = false;
manaWings = false;
sunStone = false;
fireMaw = false;
moonStone = false;
timScroll = false;
wheezeScale = false;
crystal = false;
HellGaze = false;
Bauble = false;
geodeRanged = false;
OverseerCharm = false;
ReachSummon = false;
hungryMinion = false;
EaterSummon = false;
CreeperSummon = false;
CrystalShield = false;
tankMinion = false;
babyClamper = false;
Phantom = false;
IchorPendant = false;
magazine = false;
Ward = false;
Ward1 = false;
CursedPendant = false;
BlueDust = false;
SnakeMinion = false;
Ghast = false;
starCharm = false;
eyezorEye = false;
minionName = false;
starMap = false;
NebulaPearl = false;
TiteRing = false;
sacredVine = false;
winterbornCharmMage = false;
KingRock = false;
cthulhuMinion = false;
flametrail = false;
icytrail = false;
EnchantedPaladinsHammerMinion = false;
ProbeMinion = false;
crawlerockMinion = false;
pigronMinion = false;
skeletalonMinion = false;
cragboundMinion = false;
beetleMinion = false;
shamanBand = false;
briarHeart = false;
lihzahrdMinion = false;
aeonMinion = false;
gasopodMinion = false;
Flayer = false;
steamMinion = false;
DungeonSummon = false;
OG = false;
maskPet = false;
starPet = false;
bookPet = false;
SwordPet = false;
lanternPet = false;
jellyfishPet = false;
thrallPet = false;
shadowPet = false;
saucerPet = false;
terror1Summon = false;
terror2Summon = false;
terror3Summon = false;
terror4Summon = false;
minior = false;
this.drakomireMount = false;
this.basiliskMount = false;
this.toxify = false;
this.gremlinBuff = false;
this.spiritBuff = false;
this.drakinMount = false;
this.poisonPotion = false;
this.starBuff = false;
this.runeBuff = false;
this.soulPotion = false;
this.carnivorousPlantMinion = false;
// Reset armor set booleans.
this.duskSet = false;
this.runicSet = false;
this.primalSet = false;
this.shadowSet = false;
this.cometSet = false;
this.meleeshadowSet = false;
this.rangedshadowSet = false;
this.magicshadowSet = false;
this.witherSet = false;
this.hellSet = false;
this.quickSilverSet = false;
this.reaperSet = false;
this.spiritSet = false;
this.reaperMask = false;
this.ichorSet1 = false;
this.ichorSet2 = false;
this.icySet = false;
this.fierySet = false;
this.putridSet = false;
this.reachSet = false;
this.duneSet = false;
this.leatherSet = false;
this.starSet = false;
this.bloodfireSet = false;
this.oceanSet = false;
this.titanicSet = false;
this.cryoSet = false;
this.frigidSet = false;
this.illuminantSet = false;
this.windSet = false;
this.crystalSet = false;
this.magalaSet = false;
this.depthSet = false;
this.thermalSet = false;
this.acidSet = false;
this.infernalSet = false;
this.bloomwindSet = false;
this.veinstoneSet = false;
this.clatterboneSet = false;
this.lihzahrdSet = false;
this.talonSet = false;
// Reset accessory booleans.
this.OriRing = false;
this.SRingOn = false;
this.goldenApple = false;
this.hpRegenRing = false;
this.bubbleShield = false;
this.animusLens = false;
this.deathRose = false;
this.mythrilCharm = false;
this.spiritNecklace = false;
this.KingSlayerFlask = false;
this.DarkBough = false;
this.Resolve = false;
this.MoonSongBlossom = false;
this.HolyGrail = false;
this.infernalShield = false;
this.shadowGauntlet = false;
this.moonGauntlet = false;
unboundSoulMinion = false;
if (player.FindBuffIndex(Buffs.BeetleFortitude._type) < 0)
beetleStacks = 1;
if (player.FindBuffIndex(Buffs.Glyph.CollapsingVoid._type) < 0)
voidStacks = 1;
phaseShift = false;
blazeBurn = false;
if (glyph != GlyphType.Phase)
{
phaseStacks = 0;
phaseCounter = 0;
}
if (glyph != GlyphType.Veil)
{
veilCounter = 0;
}
if (glyph != GlyphType.Radiant)
{
divineStacks = 1;
divineCounter = 0;
}
if (glyph != GlyphType.Storm)
stormStacks = 0;
if (frostCooldown > 0)
frostCooldown--;
frostRotation += Items.Glyphs.FrostGlyph.TURNRATE;
if (frostRotation > MathHelper.TwoPi)
frostRotation -= MathHelper.TwoPi;
if (frostUpdate)
{
frostUpdate = false;
if (glyph == GlyphType.Frost)
Items.Glyphs.FrostGlyph.UpdateIceSpikes(player);
}
frostCount = frostTally;
frostTally = 0;
copterFireFrame++;
onGround = false;
moving = false;
flying = false;
swimming = false;
if (player.velocity.Y != 0f)
{
if (player.mount.Active && player.mount.FlyTime > 0 && player.jump == 0 && player.controlJump && !player.mount.CanHover)
flying = true;
else if (player.wet)
swimming = true;
}
else
onGround = true;
if (player.velocity.X != 0f)
moving = true;
}
public override void ProcessTriggers(TriggersSet triggersSet)
{
if (SpiritMod.SpecialKey.JustPressed)
{
if (reaperMask && player.FindBuffIndex(mod.BuffType("WraithCooldown")) < 0)
{
player.AddBuff(mod.BuffType("WraithCooldown"), 900);
player.AddBuff(mod.BuffType("Wraith"), 300);
}
if (quickSilverSet && player.FindBuffIndex(mod.BuffType("SilverCooldown")) < 0)
{
player.AddBuff(mod.BuffType("SilverCooldown"), 1800);
for (int h = 0; h < 12; h++)
{
Vector2 vel = new Vector2(0, -1);
float rand = Main.rand.NextFloat() * 6.283f;
vel = vel.RotatedBy(rand);
vel *= 7f;
{
Vector2 mouse = new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition;
Terraria.Projectile.NewProjectile(mouse.X, mouse.Y, vel.X, vel.Y, mod.ProjectileType("QuicksilverDroplet"), 62, 2, player.whoAmI, 0f, 0f);
}
}
}
if (cometSet && player.FindBuffIndex(mod.BuffType("StarCooldown")) < 0)
{
player.AddBuff(mod.BuffType("StarCooldown"), 1800);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Star1"), 75, 0, player.whoAmI);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Star2"), 75, 0, player.whoAmI);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Star3"), 75, 0, player.whoAmI);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Star4"), 75, 0, player.whoAmI);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Star5"), 75, 0, player.whoAmI);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Star6"), 75, 0, player.whoAmI);
}
if (reaperSet && player.FindBuffIndex(mod.BuffType("FelCooldown")) < 0)
{
player.AddBuff(mod.BuffType("FelCooldown"), 2700);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("FelProj"), 0, 0, player.whoAmI);
}
if (depthSet && player.FindBuffIndex(mod.BuffType("SharkAttackBuff")) < 0)
{
MyPlayer gp = (MyPlayer)Main.player[Main.myPlayer].GetModPlayer(mod, "MyPlayer");
CombatText.NewText(new Rectangle((int)gp.player.position.X, (int)gp.player.position.Y - 60, gp.player.width, gp.player.height), new Color(29, 240, 255, 100),
"Shark Attack!");
player.AddBuff(mod.BuffType("SharkAttackBuff"), 1800);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("SharkBlast"), 35, 0, player.whoAmI);
}
if (ichorSet1 && player.FindBuffIndex(mod.BuffType("GoreCooldown1")) < 0)
{
player.AddBuff(mod.BuffType("GoreCooldown1"), 3600);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Gores"), 4, 0, player.whoAmI);
}
if (ichorSet2 && player.FindBuffIndex(mod.BuffType("GoreCooldown2")) < 0)
{
player.AddBuff(mod.BuffType("GoreCooldown2"), 3600);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Gore1"), 21, 0, player.whoAmI);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Gore1"), 21, 0, player.whoAmI);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("Gore1"), 21, 0, player.whoAmI);
}
}
if (SpiritMod.HolyKey.JustPressed)
{
if (HolyGrail && player.FindBuffIndex(mod.BuffType("HolyCooldown")) < 0)
{
player.AddBuff(mod.BuffType("HolyCooldown"), 3600);
player.AddBuff(mod.BuffType("HolyBuff"), 780);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("GrailWard"), 0, 0, player.whoAmI);
}
}
if (SpiritMod.ReachKey.JustPressed)
{
if (deathRose && player.FindBuffIndex(mod.BuffType("DeathRoseCooldown")) < 0)
{
player.AddBuff(mod.BuffType("DeathRoseCooldown"), 3600);
Projectile.NewProjectile(player.position, Vector2.Zero, mod.ProjectileType("PlantProj"), 0, 0, player.whoAmI);
}
}
}
public override bool PreItemCheck()
{
PrepareShotDetection();
return true;
}
public override void GetWeaponDamage(Item item, ref int damage)
{
BeginShotDetection(item);
}
public override void PostItemCheck()
{
EndShotDetection();
}
private void PrepareShotDetection()
{
if (player.whoAmI == Main.myPlayer && !player.HeldItem.IsAir && !Main.gamePaused)
{
MyPlayer.swingingItem = player.HeldItem;
}
}
private void BeginShotDetection(Item item)
{
if (MyPlayer.swingingItem == item)
{
MyPlayer.swingingCheck = true;
}
}
private void EndShotDetection()
{
MyPlayer.swingingItem = null;
MyPlayer.swingingCheck = false;
}
public override void SetupStartInventory(IList<Item> items)
{
Item item = new Item();
item.SetDefaults(mod.ItemType("OddKeystone"));
items.Add(item);
}
public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
{
if (junk)
return;
MyPlayer modPlayer = player.GetModPlayer<MyPlayer>(mod);
if (player.ZoneDungeon && power >= 30 && Main.rand.Next(25) == 0)
{
caughtType = mod.ItemType("MysticalCage");
}
if (modPlayer.ZoneSpirit && NPC.downedMechBossAny && Main.rand.Next(6) == 0)
{
caughtType = mod.ItemType("SpiritCrate");
}
if (modPlayer.ZoneSpirit && NPC.downedMechBossAny && Main.rand.Next(6) == 0)
{
caughtType = mod.ItemType("SpiritCrate");
}
if (modPlayer.ZoneSpirit && NPC.downedMechBossAny && Main.rand.Next(5) == 0)
{
caughtType = mod.ItemType("SpiritKoi");
}
if (Main.rand.Next(200) == 5 && NPC.downedBoss2)
{
caughtType = mod.ItemType("KeystoneShard");
}
}
public override void OnHitAnything(float x, float y, Entity victim)
{
if (TiteRing && LastEnemyHit == victim && Main.rand.Next(10) == 2)
player.AddBuff(BuffID.ShadowDodge, 145);
if (hpRegenRing && LastEnemyHit == victim && Main.rand.Next(3) == 2)
player.AddBuff(BuffID.RapidHealing, 120);
if (OriRing && LastEnemyHit == victim && Main.rand.Next(10) == 2)
{
Vector2 mouse = new Vector2(victim.position.X, victim.position.Y);
if (player.position.Y <= victim.position.Y)
{
float Xdis = player.position.X - victim.position.X; // change myplayer to nearest player in full version
float Ydis = player.position.Y - victim.position.Y; // change myplayer to nearest player in full version
float Angle = (float)Math.Atan(Xdis / Ydis);
DistXT = (float)(Math.Sin(Angle) * 300);
DistYT = (float)(Math.Cos(Angle) * 300);
DistX = (player.position.X + (0 - DistXT));
DistY = (player.position.Y + (0 - DistYT));
}
if (player.position.Y > victim.position.Y)
{
float Xdis = player.position.X - victim.position.X; // change myplayer to nearest player in full version
float Ydis = player.position.Y - victim.position.Y; // change myplayer to nearest player in full version
float Angle = (float)Math.Atan(Xdis / Ydis);
DistXT = (float)(Math.Sin(Angle) * 300);
DistYT = (float)(Math.Cos(Angle) * 300);
DistX = (player.position.X + DistXT);
DistY = (player.position.Y + DistYT);
}
Vector2 direction = victim.Center - player.Center;
direction.Normalize();
direction.X *= 20f;
direction.Y *= 20f;
float A = (float)Main.rand.Next(-100, 100) * 0.01f;
float B = (float)Main.rand.Next(-100, 100) * 0.01f;
// Projectile.NewProjectile(DistX, DistY, (0 - DistX) / 50, (0 - DistY) / 50, mod.ProjectileType("ManaStarProjectile"), damage, knockBack, player.whoAmI, 0f, 0f);
//return false;
Projectile.NewProjectile(DistX, DistY, direction.X + A, direction.Y + B, mod.ProjectileType("OriPetal"), 30, 1, player.whoAmI, 0f, 0f);
}
LastEnemyHit = victim;
}
public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
{
if (this.duneSet && item.thrown)
{
GNPC info = target.GetGlobalNPC<GNPC>(mod);
if (info.duneSetStacks++ >= 4)
{
player.AddBuff(mod.BuffType("DesertWinds"), 180);
Projectile.NewProjectile(player.position.X + 20, player.position.Y, 0, -2, mod.ProjectileType("DuneKnife"), 40, 0, Main.myPlayer);
info.duneSetStacks = 0;
}
}
if (this.icySet && item.magic && Main.rand.Next(14) == 2)
player.AddBuff(mod.BuffType("BlizzardWrath"), 240);
if (this.meleeshadowSet && Main.rand.Next(10) == 2 && item.melee)
Projectile.NewProjectile(player.position.X + 20, player.position.Y + 30, 0, -12, mod.ProjectileType("SpiritShardFriendly"), 60, 0, Main.myPlayer);
if (this.magicshadowSet && Main.rand.Next(10) == 2 && item.magic)
Projectile.NewProjectile(player.position.X + 20, player.position.Y + 30, 0, -12, mod.ProjectileType("SpiritShardFriendly"), 60, 0, Main.myPlayer);
if (this.magicshadowSet && Main.rand.Next(10) == 2 && item.summon)
Projectile.NewProjectile(player.position.X + 20, player.position.Y + 30, 0, -12, mod.ProjectileType("SpiritShardFriendly"), 60, 0, Main.myPlayer);
if (this.rangedshadowSet && Main.rand.Next(10) == 2 && item.ranged)
Projectile.NewProjectile(player.position.X + 20, player.position.Y + 30, -12, mod.ProjectileType("SpiritShardFriendly"), 60, 0, Main.myPlayer);
if (this.rangedshadowSet && Main.rand.Next(10) == 2 && item.thrown)
Projectile.NewProjectile(player.position.X + 20, player.position.Y + 30, 0, -12, mod.ProjectileType("SpiritShardFriendly"), 60, 0, Main.myPlayer);
if (this.spiritNecklace && Main.rand.Next(10) == 2 && item.melee)
{
target.AddBuff(mod.BuffType("EssenceTrap"), 240);
damage = damage + (target.defense);
}
if (this.reaperSet && Main.rand.Next(15) == 1)
target.AddBuff(mod.BuffType("FelBrand"), 160);
if (this.magalaSet && Main.rand.Next(6) == 2)
target.AddBuff(mod.BuffType("FrenzyVirus"), 240);
if (this.wheezeScale && Main.rand.Next(9) == 1 && item.melee)
{
for (int h = 0; h < 1; h++)
{
Vector2 vel = new Vector2(0, -1);
float rand = Main.rand.NextFloat() * 6.283f;
vel = vel.RotatedBy(rand);
vel *= 8f;
Projectile.NewProjectile(target.Center.X, target.Center.Y, vel.X, vel.Y, mod.ProjectileType("Wheeze"), item.damage / 2, 0, Main.myPlayer);
}
}
if (this.ToxicExtract && Main.rand.Next(5) == 1 && item.magic)
target.AddBuff(BuffID.Venom, 240);
if (this.magalaSet && item.magic && Main.rand.Next(14) == 2)
player.AddBuff(mod.BuffType("FrenzyVirus1"), 240);
if (this.frigidSet && (item.magic || item.melee) && Main.rand.Next(10) == 0)
target.AddBuff(Buffs.MageFreeze._type, 180);
if (this.magalaSet && item.ranged && Main.rand.Next(14) == 2)
player.AddBuff(mod.BuffType("FrenzyVirus1"), 240);
if (this.magalaSet && item.melee && Main.rand.Next(14) == 2)
player.AddBuff(mod.BuffType("FrenzyVirus1"), 240);
if (this.magalaSet && item.thrown && Main.rand.Next(14) == 2)
player.AddBuff(mod.BuffType("FrenzyVirus1"), 240);
if (this.sunStone && item.melee && Main.rand.Next(18) == 2)
target.AddBuff(mod.BuffType("SunBurn"), 240);
if (this.geodeSet && crit && Main.rand.Next(5) == 2)
target.AddBuff(mod.BuffType("Crystal"), 180);
if (this.gremlinBuff && item.melee)
target.AddBuff(BuffID.Poisoned, 120);
if (this.infernalFlame && item.melee)
{
if (crit)
{
if (Main.rand.Next(12) == 1)
{
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("PhoenixProjectile"), 50, 4, Main.myPlayer);
}
}
}
}
int Charger;
public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
{
if (this.frigidSet && proj.magic || proj.melee && Main.rand.Next(10) == 0)
target.AddBuff(Buffs.MageFreeze._type, 180);
if (this.reaperSet && Main.rand.Next(15) == 1)
target.AddBuff(mod.BuffType("FelBrand"), 160);
if (this.cryoSet && proj.ranged)
{
if (target.FindBuffIndex(mod.BuffType("Frozen")) > -1 && Main.rand.Next(6) == 1)
{
target.StrikeNPC(15, 0f, 0, crit);
target.StrikeNPC(15, 0f, 0, crit);
}
if (!target.boss && Main.rand.Next(17) == 1)
{
Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 49);
target.AddBuff(mod.BuffType("Frozen"), 240);
for (int i = 0; i < 20; i++)
{
int dust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 68, 0f, 0f, 100, default(Color), 2f);
Main.dust[dust].velocity *= 3f;
if (Main.rand.Next(2) == 0)
{
Main.dust[dust].scale = 0.5f;
Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int i = 0; i < 40; i++)
{
int dust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 68, 0f, 0f, 100, default(Color), 3f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 5f;
dust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 68, 0f, 0f, 100, default(Color), 2f);
Main.dust[dust].velocity *= 2f;
}
}
}
if (this.KingRock && Main.rand.Next(5) == 2 && proj.magic)
{
Projectile.NewProjectile(player.position.X + Main.rand.Next(-350, 350), player.position.Y - 350, 0, 12, mod.ProjectileType("PrismaticBolt"), 55, 0, Main.myPlayer);
Projectile.NewProjectile(player.position.X + Main.rand.Next(-350, 350), player.position.Y - 350, 0, 12, mod.ProjectileType("PrismaticBolt"), 55, 0, Main.myPlayer);
}
if (this.magalaSet && proj.thrown)
target.AddBuff(mod.BuffType("FrenzyVirus"), 180);
if (this.geodeSet && crit && Main.rand.Next(5) == 2)
target.AddBuff(mod.BuffType("Crystal"), 180);
if (this.geodeRanged && proj.ranged && Main.rand.Next(24) == 1)
{
target.AddBuff(BuffID.Frostburn, 180);
target.AddBuff(BuffID.OnFire, 180);
target.AddBuff(BuffID.CursedInferno, 180);
}
if (this.shamanBand && proj.magic && Main.rand.Next(9) == 2)
target.AddBuff(BuffID.OnFire, 180);
if (this.briarHeart && proj.magic && Main.rand.Next(9) == 2)
{
target.AddBuff(BuffID.CursedInferno, 180);
target.AddBuff(BuffID.Ichor, 180);
}
if (this.briarHeart && proj.magic && Main.rand.Next(3) == 1)
player.AddBuff(mod.BuffType("ToothBuff"), 300);
if (this.bloodfireSet && proj.magic)
{
if (Main.rand.Next(15) == 2)
target.AddBuff(mod.BuffType("BCorrupt"), 180);
if (Main.rand.Next(30) == 2)
{
player.statLife += 2;
player.HealEffect(2);
}
}
if (this.eyezorEye && proj.magic && crit && Main.rand.Next(3) == 0)
target.StrikeNPC(40, 0f, 0, crit);
if (this.sunStone && proj.melee && Main.rand.Next(18) == 2)
target.AddBuff(mod.BuffType("SunBurn"), 240);
if (this.moonStone && proj.ranged && Main.rand.Next(18) == 2)
target.AddBuff(mod.BuffType("MoonBurn"), 240);
if (this.wheezeScale && Main.rand.Next(9) == 1 && proj.melee)
{
for (int h = 0; h < 1; h++)
{
Vector2 vel = new Vector2(0, -1);
float rand = Main.rand.NextFloat() * 6.283f;
vel = vel.RotatedBy(rand);
vel *= 8f;
Projectile.NewProjectile(target.Center.X, target.Center.Y, vel.X, vel.Y, mod.ProjectileType("Wheeze"), Main.hardMode ? 40 : 20, 0, player.whoAmI, 0f, 0f);
}
}
if (this.DarkBough && proj.minion)
{
if (Main.rand.Next(15) == 0)
{
for (int h = 0; h < 6; h++)
{
Vector2 vel = new Vector2(0, -1);
float rand = Main.rand.NextFloat() * 6.283f;
vel = vel.RotatedBy(rand);
vel *= 8f;
Projectile.NewProjectile(target.Center.X, target.Center.Y, vel.X, vel.Y, mod.ProjectileType("NightmareBarb"), 29, 1, player.whoAmI, 0f, 0f);
}
}
if (Main.rand.Next(30) == 1)
{
player.statLife += 2;
player.HealEffect(2);
}
}
if (this.magazine && proj.ranged && ++Charger > 10)
{
crit = true;
Charger = 0;
}
if (this.windSet && proj.minion && Main.rand.Next(6) == 1)
{
Projectile.NewProjectile(target.Center.X, target.Center.Y, Main.rand.Next(-2, 4), -5, mod.ProjectileType("DeitySoul2"), 39, 1, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(target.Center.X, target.Center.Y, Main.rand.Next(-2, 4), -5, mod.ProjectileType("DeitySoul2"), 39, 1, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(target.Center.X, target.Center.Y, Main.rand.Next(-2, 4), -5, mod.ProjectileType("DeitySoul2"), 39, 1, player.whoAmI, 0f, 0f);
}
if (this.magalaSet && (proj.melee || proj.minion || proj.magic || proj.ranged))
target.AddBuff(mod.BuffType("FrenzyVirus"), 180);
if (this.acidImbue && Main.rand.Next(11) == 1 && proj.thrown)
target.AddBuff(mod.BuffType("AcidBurn"), 240);
if (this.spiritNecklace && proj.thrown)
target.AddBuff(mod.BuffType("EssenceTrap"), 180);
if (timScroll && proj.magic)
{
switch (Main.rand.Next(12))
{
case 0:
target.AddBuff(BuffID.OnFire, 120);