@robsonbittencourt/calc 0.11.7 → 0.11.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -138,6 +138,26 @@ describe('Berry Tests', () => {
138
138
  expect(result.desc()).not.toContain('after Sitrus Berry recovery');
139
139
  });
140
140
 
141
+ test('should NOT show Sitrus Berry recovery if field has Unnerve active', () => {
142
+ const attacker = Pokemon('Urshifu', {
143
+ level: 50,
144
+ nature: 'Adamant',
145
+ evs: {atk: 252},
146
+ });
147
+ const defender = Pokemon('Incineroar', {
148
+ level: 50,
149
+ item: 'Sitrus Berry',
150
+ nature: 'Impish',
151
+ evs: {hp: 252, def: 252},
152
+ });
153
+ const move = Move('Close Combat');
154
+ const field = new Field({isUnnerve: true});
155
+
156
+ const result = calculate(attacker, defender, move, field);
157
+
158
+ expect(result.desc()).not.toContain('after Sitrus Berry recovery');
159
+ });
160
+
141
161
  test('should show Sitrus Berry recovery with Ripen (50% recovery)', () => {
142
162
  const attacker = Pokemon('Incineroar', {
143
163
  level: 50,
@@ -374,7 +394,7 @@ describe('Berry Tests', () => {
374
394
 
375
395
  const result = calculate(attacker, defender, move, new Field());
376
396
 
377
- expect(result.desc()).toContain('Occa Berry Gholdengo: 160-190 (82.4 - 97.9%) -- guaranteed 2HKO');
397
+ expect(result.desc()).toContain('Gholdengo: 160-190 (82.4 - 97.9%) reduced by Occa Berry -- guaranteed 2HKO');
378
398
  });
379
399
 
380
400
  test('should show Passho Berry (Water) in description and reduce damage from OHKO to 2HKO', () => {
@@ -397,7 +417,7 @@ describe('Berry Tests', () => {
397
417
 
398
418
  const result = calculate(attacker, defender, move, new Field());
399
419
 
400
- expect(result.desc()).toContain('Passho Berry Incineroar on a critical hit: 150-180 (74.6 - 89.5%) -- guaranteed 2HKO');
420
+ expect(result.desc()).toContain('Incineroar on a critical hit: 150-180 (74.6 - 89.5%) reduced by Passho Berry -- guaranteed 2HKO');
401
421
  });
402
422
 
403
423
  test('should show Wacan Berry (Electric) in description and reduce damage', () => {
@@ -420,7 +440,7 @@ describe('Berry Tests', () => {
420
440
 
421
441
  const result = calculate(attacker, defender, move, new Field());
422
442
 
423
- expect(result.desc()).toContain('Wacan Berry Urshifu-Rapid-Strike: 132-156 (75.4 - 89.1%) -- guaranteed 2HKO');
443
+ expect(result.desc()).toContain('Urshifu-Rapid-Strike: 132-156 (75.4 - 89.1%) reduced by Wacan Berry -- guaranteed 2HKO');
424
444
  });
425
445
 
426
446
  test('should show Rindo Berry (Grass) in description and reduce damage', () => {
@@ -443,7 +463,7 @@ describe('Berry Tests', () => {
443
463
 
444
464
  const result = calculate(attacker, defender, move, new Field());
445
465
 
446
- expect(result.desc()).toContain('Rindo Berry Urshifu-Rapid-Strike: 127-150 (72.5 - 85.7%) -- guaranteed 2HKO');
466
+ expect(result.desc()).toContain('Urshifu-Rapid-Strike: 127-150 (72.5 - 85.7%) reduced by Rindo Berry -- guaranteed 2HKO');
447
467
  });
448
468
 
449
469
  test('should show Yache Berry (Ice) in description and reduce damage', () => {
@@ -466,7 +486,7 @@ describe('Berry Tests', () => {
466
486
 
467
487
  const result = calculate(attacker, defender, move, new Field());
468
488
 
469
- expect(result.desc()).toContain('Yache Berry Landorus-Therian: 330-390 (168.3 - 198.9%) -- guaranteed OHKO');
489
+ expect(result.desc()).toContain('Landorus-Therian: 330-390 (168.3 - 198.9%) reduced by Yache Berry -- guaranteed OHKO');
470
490
  });
471
491
 
472
492
  test('should show Chople Berry (Fighting) in description and reduce damage from OHKO to 2HKO', () => {
@@ -489,7 +509,7 @@ describe('Berry Tests', () => {
489
509
 
490
510
  const result = calculate(attacker, defender, move, new Field());
491
511
 
492
- expect(result.desc()).toContain('Chople Berry Incineroar: 93-109 (46.2 - 54.2%) -- guaranteed 2HKO');
512
+ expect(result.desc()).toContain('Incineroar: 93-109 (46.2 - 54.2%) reduced by Chople Berry -- guaranteed 2HKO');
493
513
  });
494
514
 
495
515
  test('should show Kebia Berry (Poison) in description and reduce damage', () => {
@@ -512,7 +532,7 @@ describe('Berry Tests', () => {
512
532
 
513
533
  const result = calculate(attacker, defender, move, new Field());
514
534
 
515
- expect(result.desc()).toContain('Kebia Berry Rillaboom: 112-133 (54.1 - 64.2%) -- guaranteed 2HKO');
535
+ expect(result.desc()).toContain('Rillaboom: 112-133 (54.1 - 64.2%) reduced by Kebia Berry -- guaranteed 2HKO');
516
536
  });
517
537
 
518
538
  test('should show Shuca Berry (Ground) in description and reduce damage', () => {
@@ -535,7 +555,7 @@ describe('Berry Tests', () => {
535
555
 
536
556
  const result = calculate(attacker, defender, move, new Field());
537
557
 
538
- expect(result.desc()).toContain('Shuca Berry Incineroar: 84-99 (41.7 - 49.2%) -- guaranteed 2HKO');
558
+ expect(result.desc()).toContain('Incineroar: 84-99 (41.7 - 49.2%) reduced by Shuca Berry -- guaranteed 2HKO');
539
559
  });
540
560
 
541
561
  test('should show Coba Berry (Flying) in description and reduce damage', () => {
@@ -558,7 +578,7 @@ describe('Berry Tests', () => {
558
578
 
559
579
  const result = calculate(attacker, defender, move, new Field());
560
580
 
561
- expect(result.desc()).toContain('Coba Berry Amoonguss: 115-136 (52 - 61.5%) -- guaranteed 2HKO');
581
+ expect(result.desc()).toContain('Amoonguss: 115-136 (52 - 61.5%) reduced by Coba Berry -- guaranteed 2HKO');
562
582
  });
563
583
 
564
584
  test('should show Payapa Berry (Psychic) in description and reduce damage', () => {
@@ -581,7 +601,7 @@ describe('Berry Tests', () => {
581
601
 
582
602
  const result = calculate(attacker, defender, move, new Field());
583
603
 
584
- expect(result.desc()).toContain('Payapa Berry Hawlucha: 135-159 (88.2 - 103.9%) -- 25% chance to OHKO');
604
+ expect(result.desc()).toContain('Hawlucha: 135-159 (88.2 - 103.9%) reduced by Payapa Berry -- 25% chance to OHKO');
585
605
  });
586
606
 
587
607
  test('should show Tanga Berry (Bug) in description and reduce damage', () => {
@@ -604,7 +624,7 @@ describe('Berry Tests', () => {
604
624
 
605
625
  const result = calculate(attacker, defender, move, new Field());
606
626
 
607
- expect(result.desc()).toContain('Tanga Berry Meowscarada: 114-136 (75.4 - 90%) -- guaranteed 2HKO');
627
+ expect(result.desc()).toContain('Meowscarada: 114-136 (75.4 - 90%) reduced by Tanga Berry -- guaranteed 2HKO');
608
628
  });
609
629
 
610
630
  test('should show Charti Berry (Rock) in description and reduce damage', () => {
@@ -627,7 +647,7 @@ describe('Berry Tests', () => {
627
647
 
628
648
  const result = calculate(attacker, defender, move, new Field());
629
649
 
630
- expect(result.desc()).toContain('Charti Berry Talonflame: 170-204 (111.1 - 133.3%) -- guaranteed OHKO');
650
+ expect(result.desc()).toContain('Talonflame: 170-204 (111.1 - 133.3%) reduced by Charti Berry -- guaranteed OHKO');
631
651
  });
632
652
 
633
653
  test('should show Kasib Berry (Ghost) in description and reduce damage', () => {
@@ -650,7 +670,7 @@ describe('Berry Tests', () => {
650
670
 
651
671
  const result = calculate(attacker, defender, move, new Field());
652
672
 
653
- expect(result.desc()).toContain('Kasib Berry Gholdengo: 84-99 (43.2 - 51%) -- guaranteed 2HKO');
673
+ expect(result.desc()).toContain('Gholdengo: 84-99 (43.2 - 51%) reduced by Kasib Berry -- guaranteed 2HKO');
654
674
  });
655
675
 
656
676
  test('should show Haban Berry (Dragon) in description and reduce damage', () => {
@@ -673,7 +693,7 @@ describe('Berry Tests', () => {
673
693
 
674
694
  const result = calculate(attacker, defender, move, new Field());
675
695
 
676
- expect(result.desc()).toContain('Haban Berry Dragonite: 79-94 (39.8 - 47.4%) -- guaranteed 2HKO');
696
+ expect(result.desc()).toContain('Dragonite: 79-94 (39.8 - 47.4%) reduced by Haban Berry -- guaranteed 2HKO');
677
697
  });
678
698
 
679
699
  test('should show Colbur Berry (Dark) in description and reduce damage', () => {
@@ -696,7 +716,7 @@ describe('Berry Tests', () => {
696
716
 
697
717
  const result = calculate(attacker, defender, move, new Field());
698
718
 
699
- expect(result.desc()).toContain('Colbur Berry Gholdengo: 87-103 (44.8 - 53%) -- guaranteed 2HKO');
719
+ expect(result.desc()).toContain('Gholdengo: 87-103 (44.8 - 53%) reduced by Colbur Berry -- guaranteed 2HKO');
700
720
  });
701
721
 
702
722
  test('should show Babiri Berry (Steel) in description and reduce damage', () => {
@@ -719,7 +739,7 @@ describe('Berry Tests', () => {
719
739
 
720
740
  const result = calculate(attacker, defender, move, new Field());
721
741
 
722
- expect(result.desc()).toContain('Babiri Berry Flutter Mane: 90-106 (55.5 - 65.4%) -- guaranteed 2HKO');
742
+ expect(result.desc()).toContain('Flutter Mane: 90-106 (55.5 - 65.4%) reduced by Babiri Berry -- guaranteed 2HKO');
723
743
  });
724
744
 
725
745
  test('should show Roseli Berry (Fairy) in description and reduce damage', () => {
@@ -742,7 +762,7 @@ describe('Berry Tests', () => {
742
762
 
743
763
  const result = calculate(attacker, defender, move, new Field());
744
764
 
745
- expect(result.desc()).toContain('Roseli Berry Urshifu-Rapid-Strike: 138-163 (78.8 - 93.1%) -- guaranteed 2HKO');
765
+ expect(result.desc()).toContain('Urshifu-Rapid-Strike: 138-163 (78.8 - 93.1%) reduced by Roseli Berry -- guaranteed 2HKO');
746
766
  });
747
767
 
748
768
  test('should show Chilan Berry for Normal-type moves in description and reduce damage', () => {
@@ -765,7 +785,7 @@ describe('Berry Tests', () => {
765
785
 
766
786
  const result = calculate(attacker, defender, move, new Field());
767
787
 
768
- expect(result.desc()).toContain('Chilan Berry Cresselia: 58-69 (25.5 - 30.3%) -- guaranteed 3HKO');
788
+ expect(result.desc()).toContain('Cresselia: 58-69 (25.5 - 30.3%) reduced by Chilan Berry -- guaranteed 3HKO');
769
789
  });
770
790
 
771
791
  test('should consider tera when activate halve damage berries with Ripen', () => {
@@ -787,7 +807,7 @@ describe('Berry Tests', () => {
787
807
 
788
808
  const result = calculate(attacker, defender, move, new Field());
789
809
 
790
- expect(result.desc()).toContain('32-38 (21.9 - 26%) -- guaranteed 2HKO');
810
+ expect(result.desc()).toContain('32-38 (21.9 - 26%) reduced by Chople Berry -- guaranteed 2HKO');
791
811
  });
792
812
 
793
813
  test('should work with Ripen for 75% reduction', () => {
@@ -811,7 +831,7 @@ describe('Berry Tests', () => {
811
831
 
812
832
  const result = calculate(attacker, defender, move, new Field());
813
833
 
814
- expect(result.desc()).toContain('Yache Berry Appletun: 118-139 (54.3 - 64%) -- guaranteed 2HKO');
834
+ expect(result.desc()).toContain('Appletun: 118-139 (54.3 - 64%) reduced by Yache Berry -- guaranteed 2HKO');
815
835
  });
816
836
 
817
837
  test('should NOT show berry description if attacker has Unnerve', () => {