forked from zoroarkcity/Not-BTFA-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BTFAPlayer.cs
895 lines (826 loc) · 30.2 KB
/
BTFAPlayer.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
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.ModLoader.IO;
using Terraria.DataStructures;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Localization;
using Terraria;
using ForgottenMemories.Items.ItemSets.OldGear;
using ForgottenMemories.Projectiles;
using ForgottenMemories.Buffs;
using ForgottenMemories.Buffs.ChlorophyllBuffs;
namespace ForgottenMemories
{
public class BTFAPlayer : ModPlayer
{
public bool GroundPound;
public bool Pound;
public bool AquaPowers;
public bool isGlitch;
public bool breakShop;
public static int rubixCubeSwitcher;
public bool CosmicPowers;
public bool hauntedCandle;
public bool duneBonus;
public float rangedVelocity;
public float magicAttackSpeed;
public bool boneHearts;
public bool chlorophyllPod;
private const int saveVersion = 0;
public bool Servant = false;
public bool cryotine1 = false;
public bool BlightFlameRing = false;
public bool EaterMinion = false;
public bool BlightstoneDragon = false;
public bool BlightFlameProj;
int BlightCounter = 0;
public bool WoodlouseMinion = false;
public bool CreeperMinion = false;
public bool BlightConserve = false;
public bool ShadowflameSpirit = false;
public bool BloodSlime = false;
public static bool hasProjectile;
public bool slimeGuard = false;
public bool BlightOrb = false;
public bool ChaoticSet = false;
public bool stardustCrown = false;
public bool ghastlywood = false;
public bool MagnoliacBool = true;
public bool GentBool = true;
int damageTaken = 0;
public bool treeMinion = true;
public bool lifesteal = false;
public int lifestealCap = 0;
public int lifestealTimer = 0;
public bool firestorm = false;
public bool doubleJumpMeteor = false;
public bool Tartarus = false;
public bool meteor = false;
public bool hadron = false;
public bool pearl = false;
public bool pearl2 = false;
public bool BoCBuff = false;
public bool dJumpEffectMeteor = false;
public bool sapBall = false;
public bool canJumpFirestorm = true;
public bool SlimyNeck = false;
public bool jungard = true;
public bool frostguard = false;
public bool BeeHive = false;
public bool ManaShard = false;
public bool DivineBlessing = false;
public int firestormCooldown = 0;
public bool spookedByArte = false;
public int blightDashCooldown = 0;
public bool hasBlightFlashed = true;
public bool energazerHelm = false;
public bool energazerVisor = false;
public bool phantomReapBuff = false;
public bool hasLightningArcanaProjectile1 = false;
public bool hasLightningArcanaProjectile2 = false;
public int navitasOrbisCounter = 1;
public int liberMortisCount = 1;
public int StaticShivProjectileCount = 0;
public override void ResetEffects()
{
GroundPound = false;
AquaPowers = false;
Tartarus = false;
isGlitch = false;
CosmicPowers = false;
hauntedCandle = false;
duneBonus = false;
boneHearts = false;
chlorophyllPod = false;
magicAttackSpeed = 1f;
rangedVelocity = 1f;
rubixCubeSwitcher = 0;
BlightstoneDragon = false;
BlightFlameRing = false;
BlightFlameProj = false;
BloodSlime = false;
BlightOrb = false;
Servant = false;
cryotine1 = false;
WoodlouseMinion = false;
CreeperMinion = false;
ShadowflameSpirit = false;
EaterMinion = false;
slimeGuard = false;
BlightConserve = false;
ChaoticSet = false;
stardustCrown = false;
ghastlywood = false;
MagnoliacBool = true;
GentBool = true;
firestorm = false;
doubleJumpMeteor = false;
hadron = false;
ManaShard = false;
pearl = false;
pearl2 = false;
BoCBuff = false;
treeMinion = false;
lifesteal = false;
sapBall = false;
SlimyNeck = false;
jungard = false;
frostguard = false;
BeeHive = false;
DivineBlessing = false;
spookedByArte = false;
energazerHelm = false;
energazerVisor = false;
phantomReapBuff = false;
if (!hasBlightFlashed)
{
if (blightDashCooldown == 0)
{
for (int index = 0; index < 8; ++index)
Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0.0f, 0.0f, 0, default(Color), 1f);
for (int index1 = 0; index1 < 24; ++index1)
{
int index2 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0.0f, 0.0f, 0, default(Color), 2f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity *= 2f;
int index3 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 173, 0.0f, 0.0f, 0, default(Color), 1f);
//Main.dust[index3].velocity *= 1f;
Main.dust[index3].noGravity = true;
}
Main.PlaySound(25, (int)player.position.X, (int)player.position.Y);
hasBlightFlashed = true;
}
else
{
blightDashCooldown--;
}
}
}
public override void PostUpdate()
{
if (TGEMWorld.forestInvasionUp)
{
if ((Main.invasionSize <= 20 && Main.invasionSize >0) && !Main.hardMode && !NPC.AnyNPCs(mod.NPCType("Magnoliac")) && MagnoliacBool)
{
if (!NPC.AnyNPCs(mod.NPCType("MagnoliacSwitchingPhase")))
{
if (!NPC.AnyNPCs(mod.NPCType("MagnoliacSecondStage")))
{
NPC.NewNPC((int)(player.position.X), (int)(player.position.Y - 1200), (mod.NPCType("Magnoliac")));
MagnoliacBool = false;
Main.NewText("A beast flaps it's wings to descend !", 175, 75, 255);
}
}
}
if ((Main.invasionSize <= 50 && Main.invasionSize >0) && Main.hardMode && !NPC.AnyNPCs(mod.NPCType("Magnoliac")) && MagnoliacBool)
{
if (!NPC.AnyNPCs(mod.NPCType("MagnoliacSwitchingPhase")))
{
if (!NPC.AnyNPCs(mod.NPCType("MagnoliacSecondStage")))
{
NPC.NewNPC((int)(player.position.X), (int)(player.position.Y - 1200), (mod.NPCType("Magnoliac")));
MagnoliacBool = false;
Main.NewText("A beast flaps it's wings to descend !", 175, 75, 255);
}
}
}
if ((Main.invasionSize <= 20 && Main.invasionSize >0) && Main.hardMode && !NPC.AnyNPCs(mod.NPCType("GhastlyEnt")) && GentBool)
{
GentBool = false;
NPC.NewNPC((int)(player.position.X), (int)(player.position.Y - 1200), (mod.NPCType("GhastlyEnt")));
Main.NewText("Father of nature awakens !", 175, 75, 255);
}
}
}
public override void ProcessTriggers(TriggersSet triggersSet)
{
if (ForgottenMemories.InGameWikiHotkey.JustPressed)
{
Projectile.NewProjectile(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y, 0f, 0f, mod.ProjectileType("InGameWikiMechanism"), 0, 0, player.whoAmI);
}
}
public bool TargetInBlightRing (NPC target)
{
Vector2 smartOffset = player.Center - target.position; //get vector between npc origin and player
//limit x and y of offset to within npc's hitbox
if (smartOffset.X > target.width)
smartOffset.X = target.width;
else if (smartOffset.X < 0)
smartOffset.X = 0;
if (smartOffset.Y > target.height)
smartOffset.Y = target.height;
else if (smartOffset.Y < 0)
smartOffset.Y = 0;
smartOffset += target.position; //result is the closest point on the npc's hitbox to the player
return (Vector2.Distance(smartOffset, player.Center) < 151f);
}
public override void ModifyHitNPC (Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
{
if (player.ownedProjectileCounts[mod.ProjectileType("BlightLaserOrbit")] != 0)
{
if (TargetInBlightRing(target))
{
damage = (int) (damage * 1.25);
}
}
}
public override void ModifyHitNPCWithProj (Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (player.ownedProjectileCounts[mod.ProjectileType("BlightLaserOrbit")] != 0 & proj.melee)
{
if (TargetInBlightRing(target))
{
damage = (int) (damage * 1.25);
}
}
}
public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
{
if (chlorophyllPod)
ApplyChlorophyllBuff(player);
if (Main.rand.Next(4) == 0 && lifesteal == true && !target.immortal && target.lifeMax >= 20 && lifestealCap <= 4 && damage >= 15)
{
int quickthing = Main.rand.Next(2) + 1;
player.HealEffect(quickthing);
player.statLife += (quickthing);
lifestealCap++;
}
if (Main.rand.Next(6) == 0 && DivineBlessing == true)
{
Vector2 newVect1 = new Vector2 (12, 0).RotatedBy(MathHelper.ToRadians(Main.rand.Next(360)));
int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, newVect1.X, newVect1.Y, mod.ProjectileType("LightningChain"), damage, 2f, player.whoAmI);
Main.projectile[proj].ranged = false;
}
}
public override void OnHitNPCWithProj(Projectile projectile, NPC target, int damage, float knockBack, bool Crit)
{
if (projectile.thrown && Tools.OneIn(5) && !target.immortal && boneHearts)
{
int newItem = Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, mod.ItemType("BoneHeart"));
Main.item[newItem].velocity.Y = Main.rand.NextFloat(-4.0f, 0.2f);
Main.item[newItem].velocity.X = Main.rand.NextFloat(2f, 6f) * projectile.direction;
if (Main.netMode == NetmodeID.MultiplayerClient) NetMessage.SendData(MessageID.SyncItem, -1, -1, null, newItem);
}
if (chlorophyllPod)
ApplyChlorophyllBuff(player);
if (BlightFlameProj == true && (projectile.thrown == true || projectile.ranged == true) && Main.rand.Next(5) == 0)
{
int p = Projectile.NewProjectile (target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BlightBoomRange"), damage, knockBack, player.whoAmI);
}
if (Main.rand.Next(4) == 0 && lifesteal == true && !target.immortal && target.lifeMax >= 20 && lifestealCap <= 4 && damage >= 15)
{
int quickthing = Main.rand.Next(2) + 1;
player.HealEffect(quickthing);
player.statLife += (quickthing);
lifestealCap++;
}
if (Main.rand.Next(6) == 0 && DivineBlessing == true)
{
int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("LightningChain"), damage / 2, 2f, player.whoAmI);
Main.projectile[proj].ranged = false;
}
if (sapBall == true && Main.rand.Next(3) == 0)
{
if (projectile.minion == true || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type])
{
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("SapSphere"), projectile.damage, 5f, player.whoAmI);
}
}
if (SlimyNeck == true && Main.rand.Next(7) == 0)
{
if (projectile.minion == true || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type])
{
target.AddBuff(mod.BuffType("Gelled"), 60, false);
}
}
}
public void ApplyChlorophyllBuff(Player player)
{
if (player.HasBuff(mod.BuffType<ChlorophyllBuffTwo>()))
{
player.DelBuff(player.FindBuffIndex(mod.BuffType<ChlorophyllBuffTwo>()));
player.AddBuff(mod.BuffType<ChlorophyllBuffThree>(), 4 * 60);
}
else if (player.HasBuff(mod.BuffType<ChlorophyllBuffOne>()))
{
player.DelBuff(player.FindBuffIndex(mod.BuffType<ChlorophyllBuffOne>()));
player.AddBuff(mod.BuffType<ChlorophyllBuffTwo>(), 4 * 60);
}
else if (!player.HasBuff(mod.BuffType<ChlorophyllBuffThree>()))
{
player.AddBuff(mod.BuffType<ChlorophyllBuffOne>(), 4 * 60);
}
}
public override bool ConsumeAmmo(Item weapon, Item ammo)
{
if (BlightConserve == true && Main.rand.Next(4) == 0)
{
return false;
}
return true;
}
public override void SetupStartInventory(IList<Item> items)
{
if (Tools.OneIn(5))
{
Item item = new Item();
item.SetDefaults(mod.ItemType<OldBlade>());
items.RemoveAt(0);
items.Insert(0, item);
}
if (Tools.OneIn(5))
{
Item item = new Item();
item.SetDefaults(mod.ItemType<OldPick>());
items.RemoveAt(1);
items.Insert(1, item);
}
if (Tools.OneIn(5))
{
Item item = new Item();
item.SetDefaults(mod.ItemType<OldAxe>());
items.RemoveAt(2);
items.Insert(2, item);
}
Item btfadex = new Item();
btfadex.SetDefaults(mod.ItemType<InGameWiki.Items.BTFADex>());
btfadex.stack = 1;
items.Add(btfadex);
}
public override void PreUpdate()
{
if (player.ZoneSnow && Main.raining && (player.position.Y / 16) <= Main.worldSurface)
{
if (Main.rand.Next(600) == 0)
{
Item.NewItem((int)player.position.X + Main.rand.Next(-2000, 2000), (int)player.position.Y - Main.rand.Next(233), 1, 1, mod.ItemType("Galeshard"));
}
}
if (GroundPound)
{
if (player.controlDown)
{
//if (!Pound && player.velocity.Y != 0f)
if (player.velocity.Y != 0f)
{
Pound = true;
player.velocity.Y = 30f;
Projectile.NewProjectile(player.position.X, player.position.Y + 40, 0f, 0f, mod.ProjectileType<RedFlames>(), 70, 0f, player.whoAmI);
}
else if (Pound && player.velocity.Y == 0f)
{
Pound = false;
Projectile.NewProjectile(player.position.X, player.position.Y + 40, 0f, 0f, mod.ProjectileType<RedFlameBoom>(), 105, 0f, player.whoAmI);
}
}
else if (player.velocity.Y > 0)
{
Pound = false;
if (player.controlUp)
{
//player.slowFall = true;
Projectile.NewProjectile(player.position.X, player.position.Y + player.height, 0f, 0f, mod.ProjectileType<RedFlames>(), 70, 0f, player.whoAmI);
}
}
}
/*if (GroundPound && player.controlUp && player.velocity.Y > 0)
{
Pound = false;
Projectile.NewProjectile(player.position.X, player.position.Y + 40, 0f, 0f, mod.ProjectileType<RedFlames>(), 70, 0f, player.whoAmI);
}
if (GroundPound && player.controlDown)
{
//if (!Pound && player.velocity.Y != 0f)
if (player.velocity.Y != 0f)
{
Pound = true;
player.velocity.Y = 30f;
Projectile.NewProjectile(player.position.X, player.position.Y + 40, 0f, 0f, mod.ProjectileType<RedFlames>(), 70, 0f, player.whoAmI);
}
else if (Pound && player.velocity.Y == 0f)
{
Pound = false;
Projectile.NewProjectile(player.position.X, player.position.Y + 40, 0f, 0f, mod.ProjectileType<RedFlameBoom>(), 105, 0f, player.whoAmI);
}
}*/
if (AquaPowers && Tools.OneIn(50))
{
Vector2 speed = new Vector2(Main.rand.NextFloat(-1.5f, +1.5f), Main.rand.NextFloat(-1.5f, +1.5f));
Projectile newProj = Projectile.NewProjectileDirect(player.Center, speed, mod.ProjectileType<buble>(), 18, 0f, player.whoAmI);
newProj.melee = false;
}
if (CosmicPowers == true)
{
if (player.statLife <= player.statLifeMax2 / 2)
player.AddBuff(mod.BuffType<CosmicBoon>(), 2);
else
player.AddBuff(mod.BuffType<CosmicGift>(), 2);
}
if (player.ownedProjectileCounts[mod.ProjectileType("SlimeGuard")] < 1 && slimeGuard == true)
{
Projectile.NewProjectile(player.position.X, player.position.Y, 0f, 0f, mod.ProjectileType("SlimeGuard"), 15, 1f, player.whoAmI, 0f, 0f);
}
if (player.ownedProjectileCounts[mod.ProjectileType("TartarusCurse")] < 1 && Tartarus == true)
{
Projectile.NewProjectile(player.position.X, player.position.Y, 0f, 0f, mod.ProjectileType("TartarusCurse"), 50, 1f, player.whoAmI, 0f, 0f);
}
if (player.ownedProjectileCounts[mod.ProjectileType("BlightOrb")] < 1 && BlightOrb == true)
{
Projectile.NewProjectile(player.position.X, player.position.Y, 0f, 0f, mod.ProjectileType("BlightOrb"), 45, 1f, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(player.position.X, player.position.Y, 0f, 0f, mod.ProjectileType("BlightOrb2"), 95, 1f, player.whoAmI, 0f, 0f);
}
if (player.ownedProjectileCounts[mod.ProjectileType("BlightFireOrbit")] < 12 && BlightFlameRing == true)
{
Vector2 Ring = new Vector2(150, 0).RotatedBy(MathHelper.ToRadians(player.ownedProjectileCounts[mod.ProjectileType("BlightFireOrbit")] * 30));
int p = Projectile.NewProjectile((player.position.X + Ring.X), (player.position.Y + Ring.Y), 0f, 0f, mod.ProjectileType("BlightFireOrbit"), 0, 0f, player.whoAmI, 0f, 0f);
Main.projectile[p].position += new Vector2 (Main.projectile[p].width/4, Main.projectile[p].height/4);
}
if (player.ownedProjectileCounts[mod.ProjectileType("BlightLaserOrbit")] < 1 && BlightFlameRing == true)
{
BlightCounter++;
if (BlightCounter >= 180)
{
int p = Projectile.NewProjectile((player.position.X + 150), (player.position.Y), 0f, 0f, mod.ProjectileType("BlightLaserOrbit"), 0, 0f, player.whoAmI, 0f, 0f);
Main.projectile[p].position += new Vector2 (Main.projectile[p].width/2, Main.projectile[p].height/2);
BlightCounter = 0;
}
}
lifestealTimer++;
if (lifestealTimer >= 60)
{
lifestealCap = 0;
lifestealTimer = 0;
}
if(firestorm == true)
{
firestormCooldown++;
}
if(player.controlJump)
{
if(!player.mount.Active && canJumpFirestorm == true && firestorm == true)
{
if(player.controlLeft)
{
player.velocity.X = -10f;
}
if(player.controlRight)
{
player.velocity.X = 10f;
}
Main.PlaySound(2, (int)player.Center.X, (int)player.Center.Y, 34);
int projectile = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("FireGrenadeBoom"), 15, 5f, player.whoAmI);
Main.projectile[projectile].thrown = false;
Main.projectile[projectile].timeLeft = 2;
canJumpFirestorm = false;
firestormCooldown = 0;
}
bool flag = false;
if (flag = false && meteor == true)
{
flag = true;
meteor = false;
}
if (player.velocity.Y == 0f || player.sliding || (player.autoJump && player.justJumped))
{
if (doubleJumpMeteor == true)
{
meteor = true; //refreshes the meteor jump
}
}
else if (flag == true)
{
dJumpEffectMeteor = true;
player.jump = (int)(Player.jumpHeight * 1.5f);
Main.PlaySound(2, (int)player.Center.X, (int)player.Center.Y, 34);
}
}
if (player.justJumped == true && firestormCooldown >= 10)
{
canJumpFirestorm = true;
}
}
public override void PostUpdateBuffs()
{
if (spookedByArte)
{
player.blind = true;
player.nightVision = false;
player.detectCreature = false;
}
}
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 (item.ranged && (item.type != (mod.ItemType("ArkDagger") | mod.ItemType("Fist_of_the_Hallow_Ent") | mod.ItemType("HadesHand"))))
{
speedX *= rangedVelocity;
speedY *= rangedVelocity;
}
return true;
}
public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit)
{
if (CosmicPowers)
{
int amountOfProjectiles = Main.rand.Next(2, 6);
/*for (int i = 0; i < amountOfProjectiles; ++i)
{
float sX = (float)Main.rand.Next(-40, 40) * 0.1f;
float pX = (float)Main.rand.Next(-120, 120) * 2;
int projectile = Projectile.NewProjectile(player.Center.X + pX, player.Center.Y - 500, sX, 5, mod.ProjectileType("CosmirockMeteor"), 45, 0f, player.whoAmI, 0f, 0f);
Main.projectile[projectile].timeLeft = 1000;
}*/
for (int index1 = 0; index1 < amountOfProjectiles; ++index1)
{
Vector2 position = player.Center + new Vector2(Main.rand.Next(-500, 501), -Main.rand.Next(500, 801));
Vector2 target = player.Center + new Vector2(Main.rand.Next(-150, 151), 0);
Vector2 speed = target - position;
speed.Normalize();
speed *= 8f;
int projectile = Projectile.NewProjectile(position.X, position.Y, speed.X, speed.Y, mod.ProjectileType("CosmirockMeteor"), 60, 10f, player.whoAmI, player.Center.Y);
Main.projectile[projectile].timeLeft = 1000;
}
}
if (duneBonus)
{
player.AddBuff(mod.BuffType("DuneWinds"), 10 * 60);
for (int i = 0; i < 8; i++)
{
Vector2 velocity = new Vector2(10, 0).RotatedBy((Main.rand.Next(45) + i * 45).ToRadians());
Dust newDust = Dust.NewDustDirect(player.Center, 0, 0, 32, velocity.X, velocity.Y);
newDust.noGravity = true;
newDust.scale = 2;
}
}
if (jungard && Main.rand.Next(3) == 0)
{
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("JungleGuard"), (int)(15 * (player.minionDamage * player.minionDamage * player.minionDamage)), 5f, player.whoAmI);
}
if (frostguard && Main.rand.Next(3) == 0)
{
Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("IceSlimeMinion"), (int)(12 * (player.minionDamage * player.minionDamage * player.minionDamage)), 5f, player.whoAmI);
}
if (BeeHive)
{
player.AddBuff(48, 60 * Main.rand.Next(3, 11));
int num = 3;
if (Main.rand.Next(3) == 0)
++num;
if (Main.rand.Next(3) == 0)
++num;
if (Main.rand.Next(3) == 0)
++num;
for (int index = 0; index < num; ++index)
Projectile.NewProjectile((float) player.position.X, (float) player.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, this.beeType2(), player.beeDamage(80), player.beeKB(0.0f), Main.myPlayer, 0.0f, 0.0f);
}
if (pearl && Main.rand.Next(2) == 0 && damageTaken >= 10)
{
//Vector2 ok = player.Center;
//ok.X += Main.rand.Next(-60, 61);
//ok.Y += Main.rand.Next(-60, 61);
//Item.NewItem((int)ok.X, (int)ok.Y, player.width, player.height, mod.ItemType("BlueHeart"));
player.statLife += 10;
player.HealEffect(10);
}
if (pearl && player.statLife <= player.statLifeMax2/2)
{
player.statLife += damageTaken/10;
player.HealEffect(damageTaken/10);
}
if (pearl2 && Main.rand.Next(2) == 0 && damageTaken >= 15)
{
player.statLife += 15;
player.HealEffect(15);
}
if (pearl2 && player.statLife <= player.statLifeMax2/2)
{
player.statLife += damageTaken/7;
player.HealEffect(damageTaken/7);
}
}
public void ShinyOrbSpawn()
{
int damage = 45; //set damage
float knockBack = 1.5f; //set kB
if (Main.rand.Next(15) == 0)
{
int num = 0;
for (int i = 0; i < 1000; i++) //search for amount of projctiles
{
if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && (Main.projectile[i].type == mod.ProjectileType("ShinyEnergy")))
{
num++;
}
}
if (Main.rand.Next(10) >= num && num < 10)
{
int num2 = 50;
int num3 = 24;
int num4 = 90;
for (int j = 0; j < num2; j++)
{
int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2);
Vector2 center = player.Center;
center.X += (float)Main.rand.Next(-num5, num5 + 1);
center.Y += (float)Main.rand.Next(-num5, num5 + 1);
if (!Collision.SolidCollision(center, num3, num3) && !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 num6 = (int)center.X / 16;
int num7 = (int)center.Y / 16;
bool flag = false;
if (Main.rand.Next(3) == 0 && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0)
{
flag = 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);
flag = true;
}
}
if (flag)
{
for (int k = 0; k < 1000; k++)
{
if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == mod.ProjectileType("ShinyEnergy") && (center - Main.projectile[k].Center).Length() < 48f)
{
flag = false;
break;
}
}
if (flag && Main.myPlayer == player.whoAmI)
{
Projectile.NewProjectile(center.X, center.Y, 0f, 0f, mod.ProjectileType("ShinyEnergy"), damage, knockBack, player.whoAmI, 0f, 0f);
return;
}
}
}
}
}
}
}
}
public void EmeraldSpawn()
{
int damage = 135; //set damage
float knockBack = 2f; //set kB
if (Main.rand.Next(15) == 0)
{
int num = 0;
for (int i = 0; i < 1000; i++) //search for amount of projctiles
{
if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && (Main.projectile[i].type == mod.ProjectileType("EmeraldEnergy")))
{
num++;
}
}
if (Main.rand.Next(10) >= num && num < 10)
{
int num2 = 50;
int num3 = 24;
int num4 = 90;
for (int j = 0; j < num2; j++)
{
int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2);
Vector2 center = player.Center;
center.X += (float)Main.rand.Next(-num5, num5 + 1);
center.Y += (float)Main.rand.Next(-num5, num5 + 1);
if (!Collision.SolidCollision(center, num3, num3) && !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 num6 = (int)center.X / 16;
int num7 = (int)center.Y / 16;
bool flag = false;
if (Main.rand.Next(3) == 0 && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0)
{
flag = 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);
flag = true;
}
}
if (flag)
{
for (int k = 0; k < 1000; k++)
{
if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == mod.ProjectileType("EmeraldEnergy") && (center - Main.projectile[k].Center).Length() < 48f)
{
flag = false;
break;
}
}
if (flag && Main.myPlayer == player.whoAmI)
{
Projectile.NewProjectile(center.X, center.Y, 0f, 0f, mod.ProjectileType("EmeraldEnergy"), damage, knockBack, player.whoAmI, 0f, 0f);
return;
}
}
}
}
}
}
}
}
public void EmeraldHeal()
{
if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0)
{
if (player.lifeRegenTime > 90 && player.lifeRegenTime < 1800)
{
player.lifeRegenTime = 1800;
}
player.lifeRegenTime += 6;
player.lifeRegen += 6;
}
if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2)
{
player.lifeRegenCount++;
if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0))
{
int num5 = Dust.NewDust(player.position, player.width, player.height, 55, 0f, 0f, 200, new Color(7, 255, 180), 0.5f);
Main.dust[num5].noGravity = true;
Main.dust[num5].velocity *= 0.75f;
Main.dust[num5].fadeIn = 1.3f;
Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
vector.Normalize();
vector *= (float)Main.rand.Next(50, 100) * 0.04f;
Main.dust[num5].velocity = vector;
vector.Normalize();
vector *= 34f;
Main.dust[num5].position = player.Center - vector;
}
}
}
public int beeType2()
{
if (Main.rand.Next(2) == 0)
{
return 566;
}
if (Main.rand.Next(2) == 0)
{
return 189;
}
return 181;
}
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)
{
damageTaken = damage;
return true;
}
public override float UseTimeMultiplier (Item item)
{
//if (energazerHelm && Main.LocalPlayer.FindBuffIndex(mod.BuffType("Phantom_Reap_Buff")) > -1 && player.HeldItem.type == mod.ItemType("Phantom_Reap"))
if (energazerHelm && phantomReapBuff && player.HeldItem.type == mod.ItemType("Phantom_Reap"))
{
return 2.1f;
}
if (energazerVisor)
{
return 0.9f;
}
if (energazerHelm)
{
return 1.1f;
}
//if (energazerVisor && Main.LocalPlayer.FindBuffIndex(mod.BuffType("Phantom_Reap_Buff")) > -1 && player.HeldItem.type == mod.ItemType("Phantom_Reap"))
if (energazerVisor && phantomReapBuff && player.HeldItem.type == mod.ItemType("Phantom_Reap"))
{
return 1.9f;
}
//if (Main.LocalPlayer.FindBuffIndex(mod.BuffType("Phantom_Reap_Buff")) > -1 && player.HeldItem.type == mod.ItemType("Phantom_Reap"))
if (phantomReapBuff && player.HeldItem.type == mod.ItemType("Phantom_Reap"))
{
return 2f;
}
return 1f;
}
public override void OnEnterWorld (Player player)
{
liberMortisCount = 1;
}
}
}