clashofclans.js 3.3.21 → 3.3.22-dev.2829400

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.
@@ -31,6 +31,8 @@ export declare class ClanWarAttack {
31
31
  * This is useful for calculating the new stars or destruction for new attacks.
32
32
  */
33
33
  previousBestAttack(): ClanWarAttack | null;
34
+ /** Returns new stars on the defender. */
35
+ get newStars(): number;
34
36
  }
35
37
  /** Represents a Clash of Clans War Member. */
36
38
  export declare class ClanWarMember {
@@ -51,6 +51,13 @@ class ClanWarAttack {
51
51
  .sort((a, b) => b.destruction ** b.stars - a.destruction ** a.stars)
52
52
  .at(0) ?? null);
53
53
  }
54
+ /** Returns new stars on the defender. */
55
+ get newStars() {
56
+ const prevBest = this.previousBestAttack();
57
+ if (!prevBest)
58
+ return this.stars;
59
+ return Math.max(0, this.stars - prevBest.stars);
60
+ }
54
61
  }
55
62
  exports.ClanWarAttack = ClanWarAttack;
56
63
  /** Represents a Clash of Clans War Member. */