isaacscript-common 9.17.1 → 9.18.0

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.
@@ -27,6 +27,7 @@ export declare function addCharge(player: EntityPlayer, activeSlot: ActiveSlot,
27
27
  * - 2x2 rooms and L rooms granting a double charge
28
28
  * - The Battery
29
29
  * - AAA Battery
30
+ * - Not charging active items with `chargetype="special"`
30
31
  *
31
32
  * @param player The player to grant the charges to.
32
33
  * @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
@@ -43,6 +44,7 @@ export declare function addRoomClearCharge(player: EntityPlayer, bigRoomDoubleCh
43
44
  * - L rooms and 2x2 rooms granting a double charge
44
45
  * - The Battery
45
46
  * - AAA Battery
47
+ * - Not charging active items with `chargetype="special"`
46
48
  *
47
49
  * @param player The player to grant the charges to.
48
50
  * @param activeSlot The active item slot to grant the charges to.
@@ -1 +1 @@
1
- {"version":3,"file":"charge.d.ts","sourceRoot":"","sources":["../../src/functions/charge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIX,MAAM,8BAA8B,CAAC;AAMtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,SAAI,EACd,eAAe,UAAO,GACrB,GAAG,CA2BL;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAaN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAMN;AAuED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,UAAO,GAAG,IAAI,CAIpE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAKL;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAMT;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,IAAI,CAYN"}
1
+ {"version":3,"file":"charge.d.ts","sourceRoot":"","sources":["../../src/functions/charge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAKX,MAAM,8BAA8B,CAAC;AAStC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,SAAI,EACd,eAAe,UAAO,GACrB,GAAG,CA2BL;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAaN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAkBN;AAuED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,UAAO,GAAG,IAAI,CAIpE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAKL;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAMT;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,IAAI,CAYN"}
@@ -3,12 +3,14 @@ local getClampedChargesToAdd, getChargesToAddWithAAAModifier, shouldPlayFullRech
3
3
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
4
  local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
5
5
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
6
+ local ItemConfigChargeType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigChargeType
6
7
  local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
7
8
  local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
8
9
  local ____cachedClasses = require("core.cachedClasses")
9
10
  local game = ____cachedClasses.game
10
11
  local sfxManager = ____cachedClasses.sfxManager
11
12
  local ____collectibles = require("functions.collectibles")
13
+ local getCollectibleChargeType = ____collectibles.getCollectibleChargeType
12
14
  local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
13
15
  local ____playerIndex = require("functions.playerIndex")
14
16
  local getPlayers = ____playerIndex.getPlayers
@@ -60,6 +62,7 @@ end
60
62
  -- - L rooms and 2x2 rooms granting a double charge
61
63
  -- - The Battery
62
64
  -- - AAA Battery
65
+ -- - Not charging active items with `chargetype="special"`
63
66
  --
64
67
  -- @param player The player to grant the charges to.
65
68
  -- @param activeSlot The active item slot to grant the charges to.
@@ -74,6 +77,14 @@ function ____exports.addRoomClearChargeToSlot(self, player, activeSlot, bigRoomD
74
77
  if playSoundEffect == nil then
75
78
  playSoundEffect = true
76
79
  end
80
+ local activeItem = player:GetActiveItem(activeSlot)
81
+ if activeItem == CollectibleType.NULL then
82
+ return
83
+ end
84
+ local chargeType = getCollectibleChargeType(nil, activeItem)
85
+ if chargeType == ItemConfigChargeType.SPECIAL then
86
+ return
87
+ end
77
88
  local room = game:GetRoom()
78
89
  local roomShape = room:GetRoomShape()
79
90
  local numCharges = bigRoomDoubleCharge and getRoomShapeCharges(nil, roomShape) or 1
@@ -156,6 +167,7 @@ end
156
167
  -- - 2x2 rooms and L rooms granting a double charge
157
168
  -- - The Battery
158
169
  -- - AAA Battery
170
+ -- - Not charging active items with `chargetype="special"`
159
171
  --
160
172
  -- @param player The player to grant the charges to.
161
173
  -- @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
@@ -1,8 +1,13 @@
1
- import { CollectiblePedestalType, CollectibleType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
1
+ import { CollectiblePedestalType, CollectibleType, ItemConfigChargeType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
2
2
  import { CollectibleIndex } from "../types/CollectibleIndex";
3
3
  export declare function clearCollectibleSprite(collectible: EntityPickup): void;
4
4
  /** Helper function to check if two collectible sprites have the same sprite sheet loaded. */
5
5
  export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite): boolean;
6
+ /**
7
+ * Helper function to get the charge type that a collectible has. Returns
8
+ * `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
9
+ */
10
+ export declare function getCollectibleChargeType(collectibleType: CollectibleType): ItemConfigChargeType;
6
11
  /**
7
12
  * Helper function to get the in-game description for a collectible. Returns "Unknown" if the
8
13
  * provided collectible type was not valid.
@@ -1 +1 @@
1
- {"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,eAAe,EAEf,aAAa,EAEb,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AA0B7D,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAEtE;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAsBT;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,eAAe,GAC/B,MAAM,CAeR;AAED;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,GAC/B,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAS5E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CASnE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAUnE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAuBtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAeN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,YAAY,EACzB,kBAAkB,EAAE,eAAe,GAClC,IAAI,CA2BN;AAED;;;GAGG;AACH,wBAAgB,qCAAqC,IAAI,IAAI,CAK5D"}
@@ -3,6 +3,7 @@ local initQuestionMarkSprite, COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER
3
3
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
4
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
5
5
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
6
+ local ItemConfigChargeType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigChargeType
6
7
  local ItemConfigTagZero = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTagZero
7
8
  local ItemType = ____isaac_2Dtypescript_2Ddefinitions.ItemType
8
9
  local PickupPrice = ____isaac_2Dtypescript_2Ddefinitions.PickupPrice
@@ -131,6 +132,15 @@ function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
131
132
  yIncrement
132
133
  )
133
134
  end
135
+ --- Helper function to get the charge type that a collectible has. Returns
136
+ -- `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
137
+ function ____exports.getCollectibleChargeType(self, collectibleType)
138
+ local itemConfigItem = itemConfig:GetCollectible(collectibleType)
139
+ if itemConfigItem == nil then
140
+ return ItemConfigChargeType.NORMAL
141
+ end
142
+ return itemConfigItem.ChargeType
143
+ end
134
144
  --- Helper function to get the in-game description for a collectible. Returns "Unknown" if the
135
145
  -- provided collectible type was not valid.
136
146
  function ____exports.getCollectibleDescription(self, collectibleType)
package/dist/index.d.ts CHANGED
@@ -35,6 +35,7 @@ import { GridEntityType } from 'isaac-typescript-definitions';
35
35
  import { GridEntityXMLType } from 'isaac-typescript-definitions';
36
36
  import { HeartSubType } from 'isaac-typescript-definitions';
37
37
  import { ItemConfigCardType } from 'isaac-typescript-definitions';
38
+ import { ItemConfigChargeType } from 'isaac-typescript-definitions';
38
39
  import { ItemConfigPillEffectClass } from 'isaac-typescript-definitions';
39
40
  import { ItemConfigPillEffectType } from 'isaac-typescript-definitions';
40
41
  import { ItemConfigTag } from 'isaac-typescript-definitions';
@@ -245,6 +246,7 @@ export declare function addPlayerHealthType(player: EntityPlayer, healthType: He
245
246
  * - 2x2 rooms and L rooms granting a double charge
246
247
  * - The Battery
247
248
  * - AAA Battery
249
+ * - Not charging active items with `chargetype="special"`
248
250
  *
249
251
  * @param player The player to grant the charges to.
250
252
  * @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
@@ -277,6 +279,7 @@ export declare function addRoomClearCharges(bigRoomDoubleCharge?: boolean): void
277
279
  * - L rooms and 2x2 rooms granting a double charge
278
280
  * - The Battery
279
281
  * - AAA Battery
282
+ * - Not charging active items with `chargetype="special"`
280
283
  *
281
284
  * @param player The player to grant the charges to.
282
285
  * @param activeSlot The active item slot to grant the charges to.
@@ -2622,6 +2625,12 @@ export declare function getCoinValue(coinSubType: CoinSubType): int;
2622
2625
  */
2623
2626
  export declare function getCollectibleArray(): readonly CollectibleType[];
2624
2627
 
2628
+ /**
2629
+ * Helper function to get the charge type that a collectible has. Returns
2630
+ * `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
2631
+ */
2632
+ export declare function getCollectibleChargeType(collectibleType: CollectibleType): ItemConfigChargeType;
2633
+
2625
2634
  /**
2626
2635
  * Helper function to get the in-game description for a collectible. Returns "Unknown" if the
2627
2636
  * provided collectible type was not valid.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.17.1",
3
+ "version": "9.18.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,11 +1,15 @@
1
1
  import {
2
2
  ActiveSlot,
3
3
  CollectibleType,
4
+ ItemConfigChargeType,
4
5
  SoundEffect,
5
6
  TrinketType,
6
7
  } from "isaac-typescript-definitions";
7
8
  import { game, sfxManager } from "../core/cachedClasses";
8
- import { getCollectibleMaxCharges } from "./collectibles";
9
+ import {
10
+ getCollectibleChargeType,
11
+ getCollectibleMaxCharges,
12
+ } from "./collectibles";
9
13
  import { getPlayers } from "./playerIndex";
10
14
  import { getRoomShapeCharges } from "./roomShape";
11
15
 
@@ -70,6 +74,7 @@ export function addCharge(
70
74
  * - 2x2 rooms and L rooms granting a double charge
71
75
  * - The Battery
72
76
  * - AAA Battery
77
+ * - Not charging active items with `chargetype="special"`
73
78
  *
74
79
  * @param player The player to grant the charges to.
75
80
  * @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
@@ -104,6 +109,7 @@ export function addRoomClearCharge(
104
109
  * - L rooms and 2x2 rooms granting a double charge
105
110
  * - The Battery
106
111
  * - AAA Battery
112
+ * - Not charging active items with `chargetype="special"`
107
113
  *
108
114
  * @param player The player to grant the charges to.
109
115
  * @param activeSlot The active item slot to grant the charges to.
@@ -118,6 +124,18 @@ export function addRoomClearChargeToSlot(
118
124
  bigRoomDoubleCharge = true,
119
125
  playSoundEffect = true,
120
126
  ): void {
127
+ const activeItem = player.GetActiveItem(activeSlot);
128
+ if (activeItem === CollectibleType.NULL) {
129
+ return;
130
+ }
131
+
132
+ // Certain collectibles have special charge mechanisms and are not charged upon a room being
133
+ // cleared.
134
+ const chargeType = getCollectibleChargeType(activeItem);
135
+ if (chargeType === ItemConfigChargeType.SPECIAL) {
136
+ return;
137
+ }
138
+
121
139
  const room = game.GetRoom();
122
140
  const roomShape = room.GetRoomShape();
123
141
 
@@ -2,6 +2,7 @@ import {
2
2
  CollectiblePedestalType,
3
3
  CollectibleType,
4
4
  EntityType,
5
+ ItemConfigChargeType,
5
6
  ItemConfigTag,
6
7
  ItemConfigTagZero,
7
8
  ItemType,
@@ -82,6 +83,21 @@ export function collectibleSpriteEquals(
82
83
  );
83
84
  }
84
85
 
86
+ /**
87
+ * Helper function to get the charge type that a collectible has. Returns
88
+ * `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
89
+ */
90
+ export function getCollectibleChargeType(
91
+ collectibleType: CollectibleType,
92
+ ): ItemConfigChargeType {
93
+ const itemConfigItem = itemConfig.GetCollectible(collectibleType);
94
+ if (itemConfigItem === undefined) {
95
+ return ItemConfigChargeType.NORMAL;
96
+ }
97
+
98
+ return itemConfigItem.ChargeType;
99
+ }
100
+
85
101
  /**
86
102
  * Helper function to get the in-game description for a collectible. Returns "Unknown" if the
87
103
  * provided collectible type was not valid.