isaacscript-common 31.10.1 → 31.11.1
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.
- package/dist/index.rollup.d.ts +23 -17
- package/dist/isaacscript-common.lua +155 -165
- package/dist/src/classes/callbacks/PostPlayerChangeStat.lua +2 -2
- package/dist/src/classes/features/other/CharacterStats.lua +2 -2
- package/dist/src/classes/features/other/EdenStartingStats.lua +2 -2
- package/dist/src/functions/cards.d.ts +5 -0
- package/dist/src/functions/cards.d.ts.map +1 -1
- package/dist/src/functions/cards.lua +9 -0
- package/dist/src/functions/stats.d.ts +7 -1
- package/dist/src/functions/stats.d.ts.map +1 -1
- package/dist/src/functions/stats.lua +26 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +0 -8
- package/dist/src/interfaces/PlayerStats.d.ts.map +1 -1
- package/dist/src/interfaces/PlayerStats.lua +3 -0
- package/package.json +2 -2
- package/src/classes/callbacks/PostPlayerChangeStat.ts +1 -1
- package/src/classes/features/other/CharacterStats.ts +2 -2
- package/src/classes/features/other/EdenStartingStats.ts +1 -1
- package/src/functions/cards.ts +11 -1
- package/src/functions/stats.ts +31 -1
- package/src/index.ts +0 -1
- package/src/interfaces/PlayerStats.ts +3 -0
- package/dist/src/functions/playerStats.d.ts +0 -8
- package/dist/src/functions/playerStats.d.ts.map +0 -1
- package/dist/src/functions/playerStats.lua +0 -27
- package/src/functions/playerStats.ts +0 -30
package/dist/index.rollup.d.ts
CHANGED
|
@@ -828,6 +828,23 @@ export declare function addFlag<T extends BitFlag | BitFlag128>(flags: T | BitFl
|
|
|
828
828
|
|
|
829
829
|
export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
|
|
830
830
|
|
|
831
|
+
/**
|
|
832
|
+
* Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
|
|
833
|
+
* from the `EVALUATE_CACHE` callback.
|
|
834
|
+
*
|
|
835
|
+
* Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
|
|
836
|
+
* to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
|
|
837
|
+
*
|
|
838
|
+
* This function supports the following cache flags:
|
|
839
|
+
* - CacheFlag.DAMAGE (1 << 0)
|
|
840
|
+
* - CacheFlag.FIRE_DELAY (1 << 1)
|
|
841
|
+
* - CacheFlag.SHOT_SPEED (1 << 2)
|
|
842
|
+
* - CacheFlag.RANGE (1 << 3)
|
|
843
|
+
* - CacheFlag.SPEED (1 << 4)
|
|
844
|
+
* - CacheFlag.LUCK (1 << 10)
|
|
845
|
+
*/
|
|
846
|
+
export declare function addPlayerStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
|
|
847
|
+
|
|
831
848
|
/**
|
|
832
849
|
* Helper function to add a charge to a player's active item(s), emulating what happens when a room
|
|
833
850
|
* is cleared.
|
|
@@ -902,23 +919,6 @@ export declare function addRoomDisplayFlag(roomGridIndex: int | undefined, displ
|
|
|
902
919
|
*/
|
|
903
920
|
export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: Array<Set<T> | ReadonlySet<T>>): void;
|
|
904
921
|
|
|
905
|
-
/**
|
|
906
|
-
* Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
|
|
907
|
-
* from the `EVALUATE_CACHE` callback.
|
|
908
|
-
*
|
|
909
|
-
* Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
|
|
910
|
-
* to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
|
|
911
|
-
*
|
|
912
|
-
* This function supports the following cache flags:
|
|
913
|
-
* - CacheFlag.DAMAGE (1 << 0)
|
|
914
|
-
* - CacheFlag.FIRE_DELAY (1 << 1)
|
|
915
|
-
* - CacheFlag.SHOT_SPEED (1 << 2)
|
|
916
|
-
* - CacheFlag.RANGE (1 << 3)
|
|
917
|
-
* - CacheFlag.SPEED (1 << 4)
|
|
918
|
-
* - CacheFlag.LUCK (1 << 10)
|
|
919
|
-
*/
|
|
920
|
-
export declare function addStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
|
|
921
|
-
|
|
922
922
|
/**
|
|
923
923
|
* - Converts the specified amount of tears stat into the format of `EntityPlayer.MaxFireDelay` and
|
|
924
924
|
* adds it to the player.
|
|
@@ -17227,6 +17227,12 @@ export declare type UppercaseKeys<T> = StartsWithUppercase<keyof T>;
|
|
|
17227
17227
|
*/
|
|
17228
17228
|
export declare function useActiveItemTemp(player: EntityPlayer, collectibleType: CollectibleType): void;
|
|
17229
17229
|
|
|
17230
|
+
/**
|
|
17231
|
+
* Helper function to use a card without showing an animation and without the announcer voice
|
|
17232
|
+
* playing.
|
|
17233
|
+
*/
|
|
17234
|
+
export declare function useCardTemp(player: EntityPlayer, cardType: CardType): void;
|
|
17235
|
+
|
|
17230
17236
|
/**
|
|
17231
17237
|
* Helper function to check every value of a custom enum for -1. Will throw an run-time error if any
|
|
17232
17238
|
* -1 values are found. This is helpful because many methods of the Isaac class return -1 if they
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 31.
|
|
3
|
+
isaacscript-common 31.11.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -17248,6 +17248,9 @@ return ____exports
|
|
|
17248
17248
|
end,
|
|
17249
17249
|
["src.interfaces.PlayerStats"] = function(...)
|
|
17250
17250
|
local ____exports = {}
|
|
17251
|
+
local ____enums = require("src.functions.enums")
|
|
17252
|
+
local validateInterfaceMatchesEnum = ____enums.validateInterfaceMatchesEnum
|
|
17253
|
+
validateInterfaceMatchesEnum(nil)
|
|
17251
17254
|
return ____exports
|
|
17252
17255
|
end,
|
|
17253
17256
|
["src.interfaces.private.AddCallbackParametersCustom"] = function(...)
|
|
@@ -30718,10 +30721,86 @@ function PostPlayerChangeHealth.prototype.____constructor(self)
|
|
|
30718
30721
|
end
|
|
30719
30722
|
return ____exports
|
|
30720
30723
|
end,
|
|
30721
|
-
["src.functions.
|
|
30724
|
+
["src.functions.tears"] = function(...)
|
|
30722
30725
|
local ____exports = {}
|
|
30726
|
+
function ____exports.getFireDelay(self, tearsStat)
|
|
30727
|
+
return math.max(30 / tearsStat - 1, -0.9999)
|
|
30728
|
+
end
|
|
30729
|
+
function ____exports.getTearsStat(self, fireDelay)
|
|
30730
|
+
return 30 / (fireDelay + 1)
|
|
30731
|
+
end
|
|
30732
|
+
function ____exports.addTearsStat(self, player, tearsStat)
|
|
30733
|
+
local existingTearsStat = ____exports.getTearsStat(nil, player.MaxFireDelay)
|
|
30734
|
+
local newTearsStat = existingTearsStat + tearsStat
|
|
30735
|
+
local newMaxFireDelay = ____exports.getFireDelay(nil, newTearsStat)
|
|
30736
|
+
player.MaxFireDelay = newMaxFireDelay
|
|
30737
|
+
end
|
|
30738
|
+
function ____exports.isTearFromFamiliar(self, tear, familiarVariant, subType)
|
|
30739
|
+
if tear.FrameCount == 0 then
|
|
30740
|
+
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
30741
|
+
end
|
|
30742
|
+
if tear.SpawnerEntity == nil then
|
|
30743
|
+
return false
|
|
30744
|
+
end
|
|
30745
|
+
local familiar = tear.SpawnerEntity:ToFamiliar()
|
|
30746
|
+
if familiar == nil then
|
|
30747
|
+
return false
|
|
30748
|
+
end
|
|
30749
|
+
return (familiarVariant == nil or familiarVariant == familiar.Variant) and (subType == nil or subType == familiar.SubType)
|
|
30750
|
+
end
|
|
30751
|
+
function ____exports.isTearFromPlayer(self, tear)
|
|
30752
|
+
if tear.FrameCount == 0 then
|
|
30753
|
+
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
30754
|
+
end
|
|
30755
|
+
if tear.SpawnerEntity == nil then
|
|
30756
|
+
return false
|
|
30757
|
+
end
|
|
30758
|
+
local player = tear.SpawnerEntity:ToPlayer()
|
|
30759
|
+
return player ~= nil
|
|
30760
|
+
end
|
|
30761
|
+
return ____exports
|
|
30762
|
+
end,
|
|
30763
|
+
["src.maps.defaultPlayerStatMap"] = function(...)
|
|
30764
|
+
local ____lualib = require("lualib_bundle")
|
|
30765
|
+
local __TS__New = ____lualib.__TS__New
|
|
30766
|
+
local ____exports = {}
|
|
30767
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
30768
|
+
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
30769
|
+
local ____tears = require("src.functions.tears")
|
|
30770
|
+
local getTearsStat = ____tears.getTearsStat
|
|
30771
|
+
local ____ReadonlyMap = require("src.types.ReadonlyMap")
|
|
30772
|
+
local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
|
|
30773
|
+
local DEFAULT_MAX_FIRE_DELAY = 10
|
|
30774
|
+
____exports.DEFAULT_PLAYER_STAT_MAP = __TS__New(
|
|
30775
|
+
ReadonlyMap,
|
|
30776
|
+
{
|
|
30777
|
+
{CacheFlag.DAMAGE, 3.5},
|
|
30778
|
+
{
|
|
30779
|
+
CacheFlag.FIRE_DELAY,
|
|
30780
|
+
getTearsStat(nil, DEFAULT_MAX_FIRE_DELAY)
|
|
30781
|
+
},
|
|
30782
|
+
{CacheFlag.SHOT_SPEED, 1},
|
|
30783
|
+
{CacheFlag.RANGE, 6.5},
|
|
30784
|
+
{CacheFlag.SPEED, 1},
|
|
30785
|
+
{CacheFlag.LUCK, 0}
|
|
30786
|
+
}
|
|
30787
|
+
)
|
|
30788
|
+
return ____exports
|
|
30789
|
+
end,
|
|
30790
|
+
["src.functions.stats"] = function(...)
|
|
30791
|
+
local ____lualib = require("lualib_bundle")
|
|
30792
|
+
local __TS__New = ____lualib.__TS__New
|
|
30793
|
+
local ____exports = {}
|
|
30794
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
30795
|
+
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
30723
30796
|
local ____PlayerStat = require("src.enums.PlayerStat")
|
|
30724
30797
|
local PlayerStat = ____PlayerStat.PlayerStat
|
|
30798
|
+
local ____defaultPlayerStatMap = require("src.maps.defaultPlayerStatMap")
|
|
30799
|
+
local DEFAULT_PLAYER_STAT_MAP = ____defaultPlayerStatMap.DEFAULT_PLAYER_STAT_MAP
|
|
30800
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
30801
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
30802
|
+
local ____tears = require("src.functions.tears")
|
|
30803
|
+
local addTearsStat = ____tears.addTearsStat
|
|
30725
30804
|
function ____exports.getPlayerStats(self, player)
|
|
30726
30805
|
return {
|
|
30727
30806
|
[PlayerStat.DAMAGE] = player.Damage,
|
|
@@ -30739,6 +30818,67 @@ function ____exports.getPlayerStats(self, player)
|
|
|
30739
30818
|
[PlayerStat.SIZE] = player.SpriteScale
|
|
30740
30819
|
}
|
|
30741
30820
|
end
|
|
30821
|
+
local STAT_CACHE_FLAGS_SET = __TS__New(ReadonlySet, {
|
|
30822
|
+
CacheFlag.DAMAGE,
|
|
30823
|
+
CacheFlag.FIRE_DELAY,
|
|
30824
|
+
CacheFlag.SHOT_SPEED,
|
|
30825
|
+
CacheFlag.RANGE,
|
|
30826
|
+
CacheFlag.SPEED,
|
|
30827
|
+
CacheFlag.LUCK
|
|
30828
|
+
})
|
|
30829
|
+
function ____exports.addPlayerStat(self, player, cacheFlag, amount)
|
|
30830
|
+
if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
|
|
30831
|
+
error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
|
|
30832
|
+
end
|
|
30833
|
+
repeat
|
|
30834
|
+
local ____switch4 = cacheFlag
|
|
30835
|
+
local ____cond4 = ____switch4 == CacheFlag.DAMAGE
|
|
30836
|
+
if ____cond4 then
|
|
30837
|
+
do
|
|
30838
|
+
player.Damage = player.Damage + amount
|
|
30839
|
+
break
|
|
30840
|
+
end
|
|
30841
|
+
end
|
|
30842
|
+
____cond4 = ____cond4 or ____switch4 == CacheFlag.FIRE_DELAY
|
|
30843
|
+
if ____cond4 then
|
|
30844
|
+
do
|
|
30845
|
+
addTearsStat(nil, player, amount)
|
|
30846
|
+
break
|
|
30847
|
+
end
|
|
30848
|
+
end
|
|
30849
|
+
____cond4 = ____cond4 or ____switch4 == CacheFlag.SHOT_SPEED
|
|
30850
|
+
if ____cond4 then
|
|
30851
|
+
do
|
|
30852
|
+
player.ShotSpeed = player.ShotSpeed + amount
|
|
30853
|
+
break
|
|
30854
|
+
end
|
|
30855
|
+
end
|
|
30856
|
+
____cond4 = ____cond4 or ____switch4 == CacheFlag.RANGE
|
|
30857
|
+
if ____cond4 then
|
|
30858
|
+
do
|
|
30859
|
+
player.TearHeight = player.TearHeight + amount
|
|
30860
|
+
break
|
|
30861
|
+
end
|
|
30862
|
+
end
|
|
30863
|
+
____cond4 = ____cond4 or ____switch4 == CacheFlag.SPEED
|
|
30864
|
+
if ____cond4 then
|
|
30865
|
+
do
|
|
30866
|
+
player.MoveSpeed = player.MoveSpeed + amount
|
|
30867
|
+
break
|
|
30868
|
+
end
|
|
30869
|
+
end
|
|
30870
|
+
____cond4 = ____cond4 or ____switch4 == CacheFlag.LUCK
|
|
30871
|
+
if ____cond4 then
|
|
30872
|
+
do
|
|
30873
|
+
player.Luck = player.Luck + amount
|
|
30874
|
+
break
|
|
30875
|
+
end
|
|
30876
|
+
end
|
|
30877
|
+
until true
|
|
30878
|
+
end
|
|
30879
|
+
function ____exports.getDefaultPlayerStat(self, cacheFlag)
|
|
30880
|
+
return DEFAULT_PLAYER_STAT_MAP:get(cacheFlag)
|
|
30881
|
+
end
|
|
30742
30882
|
function ____exports.getPlayerStat(self, player, playerStat)
|
|
30743
30883
|
local playerStats = ____exports.getPlayerStats(nil, player)
|
|
30744
30884
|
return playerStats[playerStat]
|
|
@@ -30764,8 +30904,8 @@ local colorEquals = ____color.colorEquals
|
|
|
30764
30904
|
local isColor = ____color.isColor
|
|
30765
30905
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
30766
30906
|
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
30767
|
-
local
|
|
30768
|
-
local getPlayerStat =
|
|
30907
|
+
local ____stats = require("src.functions.stats")
|
|
30908
|
+
local getPlayerStat = ____stats.getPlayerStat
|
|
30769
30909
|
local ____types = require("src.functions.types")
|
|
30770
30910
|
local isBoolean = ____types.isBoolean
|
|
30771
30911
|
local isNumber = ____types.isNumber
|
|
@@ -37829,6 +37969,7 @@ return ____exports
|
|
|
37829
37969
|
local ____exports = {}
|
|
37830
37970
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
37831
37971
|
local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
|
|
37972
|
+
local UseFlag = ____isaac_2Dtypescript_2Ddefinitions.UseFlag
|
|
37832
37973
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
37833
37974
|
local itemConfig = ____cachedClasses.itemConfig
|
|
37834
37975
|
local ____constantsFirstLast = require("src.core.constantsFirstLast")
|
|
@@ -37842,6 +37983,8 @@ local CARD_NAMES = ____cardNames.CARD_NAMES
|
|
|
37842
37983
|
local DEFAULT_CARD_NAME = ____cardNames.DEFAULT_CARD_NAME
|
|
37843
37984
|
local ____itemConfigCardTypesForCardsSet = require("src.sets.itemConfigCardTypesForCardsSet")
|
|
37844
37985
|
local ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = ____itemConfigCardTypesForCardsSet.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET
|
|
37986
|
+
local ____flag = require("src.functions.flag")
|
|
37987
|
+
local addFlag = ____flag.addFlag
|
|
37845
37988
|
local ____utils = require("src.functions.utils")
|
|
37846
37989
|
local iRange = ____utils.iRange
|
|
37847
37990
|
function ____exports.isVanillaCardType(self, cardType)
|
|
@@ -37910,6 +38053,10 @@ end
|
|
|
37910
38053
|
function ____exports.isTarotCard(self, cardType)
|
|
37911
38054
|
return ____exports.isCardType(nil, cardType, ItemConfigCardType.TAROT)
|
|
37912
38055
|
end
|
|
38056
|
+
function ____exports.useCardTemp(self, player, cardType)
|
|
38057
|
+
local useFlags = addFlag(nil, UseFlag.NO_ANIMATION, UseFlag.NO_ANNOUNCER_VOICE)
|
|
38058
|
+
player:UseCard(cardType, useFlags)
|
|
38059
|
+
end
|
|
37913
38060
|
return ____exports
|
|
37914
38061
|
end,
|
|
37915
38062
|
["src.functions.collectibleTag"] = function(...)
|
|
@@ -39843,147 +39990,6 @@ function CharacterHealthConversion.prototype.registerCharacterHealthConversion(s
|
|
|
39843
39990
|
self.characterHealthReplacementMap:set(playerType, conversionHeartSubType)
|
|
39844
39991
|
end
|
|
39845
39992
|
__TS__DecorateLegacy({Exported}, CharacterHealthConversion.prototype, "registerCharacterHealthConversion", true)
|
|
39846
|
-
return ____exports
|
|
39847
|
-
end,
|
|
39848
|
-
["src.functions.tears"] = function(...)
|
|
39849
|
-
local ____exports = {}
|
|
39850
|
-
function ____exports.getFireDelay(self, tearsStat)
|
|
39851
|
-
return math.max(30 / tearsStat - 1, -0.9999)
|
|
39852
|
-
end
|
|
39853
|
-
function ____exports.getTearsStat(self, fireDelay)
|
|
39854
|
-
return 30 / (fireDelay + 1)
|
|
39855
|
-
end
|
|
39856
|
-
function ____exports.addTearsStat(self, player, tearsStat)
|
|
39857
|
-
local existingTearsStat = ____exports.getTearsStat(nil, player.MaxFireDelay)
|
|
39858
|
-
local newTearsStat = existingTearsStat + tearsStat
|
|
39859
|
-
local newMaxFireDelay = ____exports.getFireDelay(nil, newTearsStat)
|
|
39860
|
-
player.MaxFireDelay = newMaxFireDelay
|
|
39861
|
-
end
|
|
39862
|
-
function ____exports.isTearFromFamiliar(self, tear, familiarVariant, subType)
|
|
39863
|
-
if tear.FrameCount == 0 then
|
|
39864
|
-
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
39865
|
-
end
|
|
39866
|
-
if tear.SpawnerEntity == nil then
|
|
39867
|
-
return false
|
|
39868
|
-
end
|
|
39869
|
-
local familiar = tear.SpawnerEntity:ToFamiliar()
|
|
39870
|
-
if familiar == nil then
|
|
39871
|
-
return false
|
|
39872
|
-
end
|
|
39873
|
-
return (familiarVariant == nil or familiarVariant == familiar.Variant) and (subType == nil or subType == familiar.SubType)
|
|
39874
|
-
end
|
|
39875
|
-
function ____exports.isTearFromPlayer(self, tear)
|
|
39876
|
-
if tear.FrameCount == 0 then
|
|
39877
|
-
error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromPlayer\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
|
|
39878
|
-
end
|
|
39879
|
-
if tear.SpawnerEntity == nil then
|
|
39880
|
-
return false
|
|
39881
|
-
end
|
|
39882
|
-
local player = tear.SpawnerEntity:ToPlayer()
|
|
39883
|
-
return player ~= nil
|
|
39884
|
-
end
|
|
39885
|
-
return ____exports
|
|
39886
|
-
end,
|
|
39887
|
-
["src.maps.defaultPlayerStatMap"] = function(...)
|
|
39888
|
-
local ____lualib = require("lualib_bundle")
|
|
39889
|
-
local __TS__New = ____lualib.__TS__New
|
|
39890
|
-
local ____exports = {}
|
|
39891
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
39892
|
-
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
39893
|
-
local ____tears = require("src.functions.tears")
|
|
39894
|
-
local getTearsStat = ____tears.getTearsStat
|
|
39895
|
-
local ____ReadonlyMap = require("src.types.ReadonlyMap")
|
|
39896
|
-
local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
|
|
39897
|
-
local DEFAULT_MAX_FIRE_DELAY = 10
|
|
39898
|
-
____exports.DEFAULT_PLAYER_STAT_MAP = __TS__New(
|
|
39899
|
-
ReadonlyMap,
|
|
39900
|
-
{
|
|
39901
|
-
{CacheFlag.DAMAGE, 3.5},
|
|
39902
|
-
{
|
|
39903
|
-
CacheFlag.FIRE_DELAY,
|
|
39904
|
-
getTearsStat(nil, DEFAULT_MAX_FIRE_DELAY)
|
|
39905
|
-
},
|
|
39906
|
-
{CacheFlag.SHOT_SPEED, 1},
|
|
39907
|
-
{CacheFlag.RANGE, 6.5},
|
|
39908
|
-
{CacheFlag.SPEED, 1},
|
|
39909
|
-
{CacheFlag.LUCK, 0}
|
|
39910
|
-
}
|
|
39911
|
-
)
|
|
39912
|
-
return ____exports
|
|
39913
|
-
end,
|
|
39914
|
-
["src.functions.stats"] = function(...)
|
|
39915
|
-
local ____lualib = require("lualib_bundle")
|
|
39916
|
-
local __TS__New = ____lualib.__TS__New
|
|
39917
|
-
local ____exports = {}
|
|
39918
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
39919
|
-
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
39920
|
-
local ____defaultPlayerStatMap = require("src.maps.defaultPlayerStatMap")
|
|
39921
|
-
local DEFAULT_PLAYER_STAT_MAP = ____defaultPlayerStatMap.DEFAULT_PLAYER_STAT_MAP
|
|
39922
|
-
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
39923
|
-
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
39924
|
-
local ____tears = require("src.functions.tears")
|
|
39925
|
-
local addTearsStat = ____tears.addTearsStat
|
|
39926
|
-
local STAT_CACHE_FLAGS_SET = __TS__New(ReadonlySet, {
|
|
39927
|
-
CacheFlag.DAMAGE,
|
|
39928
|
-
CacheFlag.FIRE_DELAY,
|
|
39929
|
-
CacheFlag.SHOT_SPEED,
|
|
39930
|
-
CacheFlag.RANGE,
|
|
39931
|
-
CacheFlag.SPEED,
|
|
39932
|
-
CacheFlag.LUCK
|
|
39933
|
-
})
|
|
39934
|
-
function ____exports.addStat(self, player, cacheFlag, amount)
|
|
39935
|
-
if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
|
|
39936
|
-
error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
|
|
39937
|
-
end
|
|
39938
|
-
repeat
|
|
39939
|
-
local ____switch4 = cacheFlag
|
|
39940
|
-
local ____cond4 = ____switch4 == CacheFlag.DAMAGE
|
|
39941
|
-
if ____cond4 then
|
|
39942
|
-
do
|
|
39943
|
-
player.Damage = player.Damage + amount
|
|
39944
|
-
break
|
|
39945
|
-
end
|
|
39946
|
-
end
|
|
39947
|
-
____cond4 = ____cond4 or ____switch4 == CacheFlag.FIRE_DELAY
|
|
39948
|
-
if ____cond4 then
|
|
39949
|
-
do
|
|
39950
|
-
addTearsStat(nil, player, amount)
|
|
39951
|
-
break
|
|
39952
|
-
end
|
|
39953
|
-
end
|
|
39954
|
-
____cond4 = ____cond4 or ____switch4 == CacheFlag.SHOT_SPEED
|
|
39955
|
-
if ____cond4 then
|
|
39956
|
-
do
|
|
39957
|
-
player.ShotSpeed = player.ShotSpeed + amount
|
|
39958
|
-
break
|
|
39959
|
-
end
|
|
39960
|
-
end
|
|
39961
|
-
____cond4 = ____cond4 or ____switch4 == CacheFlag.RANGE
|
|
39962
|
-
if ____cond4 then
|
|
39963
|
-
do
|
|
39964
|
-
player.TearHeight = player.TearHeight + amount
|
|
39965
|
-
break
|
|
39966
|
-
end
|
|
39967
|
-
end
|
|
39968
|
-
____cond4 = ____cond4 or ____switch4 == CacheFlag.SPEED
|
|
39969
|
-
if ____cond4 then
|
|
39970
|
-
do
|
|
39971
|
-
player.MoveSpeed = player.MoveSpeed + amount
|
|
39972
|
-
break
|
|
39973
|
-
end
|
|
39974
|
-
end
|
|
39975
|
-
____cond4 = ____cond4 or ____switch4 == CacheFlag.LUCK
|
|
39976
|
-
if ____cond4 then
|
|
39977
|
-
do
|
|
39978
|
-
player.Luck = player.Luck + amount
|
|
39979
|
-
break
|
|
39980
|
-
end
|
|
39981
|
-
end
|
|
39982
|
-
until true
|
|
39983
|
-
end
|
|
39984
|
-
function ____exports.getDefaultPlayerStat(self, cacheFlag)
|
|
39985
|
-
return DEFAULT_PLAYER_STAT_MAP:get(cacheFlag)
|
|
39986
|
-
end
|
|
39987
39993
|
return ____exports
|
|
39988
39994
|
end,
|
|
39989
39995
|
["src.classes.features.other.CharacterStats"] = function(...)
|
|
@@ -39999,7 +40005,7 @@ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
|
39999
40005
|
local ____decorators = require("src.decorators")
|
|
40000
40006
|
local Exported = ____decorators.Exported
|
|
40001
40007
|
local ____stats = require("src.functions.stats")
|
|
40002
|
-
local
|
|
40008
|
+
local addPlayerStat = ____stats.addPlayerStat
|
|
40003
40009
|
local getDefaultPlayerStat = ____stats.getDefaultPlayerStat
|
|
40004
40010
|
local ____Feature = require("src.classes.private.Feature")
|
|
40005
40011
|
local Feature = ____Feature.Feature
|
|
@@ -40022,7 +40028,7 @@ function CharacterStats.prototype.____constructor(self)
|
|
|
40022
40028
|
return
|
|
40023
40029
|
end
|
|
40024
40030
|
local delta = stat - defaultStat
|
|
40025
|
-
|
|
40031
|
+
addPlayerStat(nil, player, cacheFlag, delta)
|
|
40026
40032
|
end
|
|
40027
40033
|
self.callbacksUsed = {{ModCallback.EVALUATE_CACHE, self.evaluateCache}}
|
|
40028
40034
|
end
|
|
@@ -47460,10 +47466,10 @@ local Exported = ____decorators.Exported
|
|
|
47460
47466
|
local ____playerDataStructures = require("src.functions.playerDataStructures")
|
|
47461
47467
|
local mapGetPlayer = ____playerDataStructures.mapGetPlayer
|
|
47462
47468
|
local mapSetPlayer = ____playerDataStructures.mapSetPlayer
|
|
47463
|
-
local ____playerStats = require("src.functions.playerStats")
|
|
47464
|
-
local getPlayerStats = ____playerStats.getPlayerStats
|
|
47465
47469
|
local ____players = require("src.functions.players")
|
|
47466
47470
|
local isEden = ____players.isEden
|
|
47471
|
+
local ____stats = require("src.functions.stats")
|
|
47472
|
+
local getPlayerStats = ____stats.getPlayerStats
|
|
47467
47473
|
local ____Feature = require("src.classes.private.Feature")
|
|
47468
47474
|
local Feature = ____Feature.Feature
|
|
47469
47475
|
local v = {run = {edenPlayerStats = __TS__New(Map)}}
|
|
@@ -54791,14 +54797,6 @@ do
|
|
|
54791
54797
|
end
|
|
54792
54798
|
end
|
|
54793
54799
|
end
|
|
54794
|
-
do
|
|
54795
|
-
local ____export = require("src.functions.playerStats")
|
|
54796
|
-
for ____exportKey, ____exportValue in pairs(____export) do
|
|
54797
|
-
if ____exportKey ~= "default" then
|
|
54798
|
-
____exports[____exportKey] = ____exportValue
|
|
54799
|
-
end
|
|
54800
|
-
end
|
|
54801
|
-
end
|
|
54802
54800
|
do
|
|
54803
54801
|
local ____export = require("src.functions.players")
|
|
54804
54802
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -55915,14 +55913,6 @@ do
|
|
|
55915
55913
|
end
|
|
55916
55914
|
end
|
|
55917
55915
|
end
|
|
55918
|
-
do
|
|
55919
|
-
local ____export = require("src.functions.playerStats")
|
|
55920
|
-
for ____exportKey, ____exportValue in pairs(____export) do
|
|
55921
|
-
if ____exportKey ~= "default" then
|
|
55922
|
-
____exports[____exportKey] = ____exportValue
|
|
55923
|
-
end
|
|
55924
|
-
end
|
|
55925
|
-
end
|
|
55926
55916
|
do
|
|
55927
55917
|
local ____export = require("src.functions.players")
|
|
55928
55918
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -16,8 +16,8 @@ local colorEquals = ____color.colorEquals
|
|
|
16
16
|
local isColor = ____color.isColor
|
|
17
17
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
18
18
|
local getPlayerIndex = ____playerIndex.getPlayerIndex
|
|
19
|
-
local
|
|
20
|
-
local getPlayerStat =
|
|
19
|
+
local ____stats = require("src.functions.stats")
|
|
20
|
+
local getPlayerStat = ____stats.getPlayerStat
|
|
21
21
|
local ____types = require("src.functions.types")
|
|
22
22
|
local isBoolean = ____types.isBoolean
|
|
23
23
|
local isNumber = ____types.isNumber
|
|
@@ -10,7 +10,7 @@ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
|
10
10
|
local ____decorators = require("src.decorators")
|
|
11
11
|
local Exported = ____decorators.Exported
|
|
12
12
|
local ____stats = require("src.functions.stats")
|
|
13
|
-
local
|
|
13
|
+
local addPlayerStat = ____stats.addPlayerStat
|
|
14
14
|
local getDefaultPlayerStat = ____stats.getDefaultPlayerStat
|
|
15
15
|
local ____Feature = require("src.classes.private.Feature")
|
|
16
16
|
local Feature = ____Feature.Feature
|
|
@@ -34,7 +34,7 @@ function CharacterStats.prototype.____constructor(self)
|
|
|
34
34
|
return
|
|
35
35
|
end
|
|
36
36
|
local delta = stat - defaultStat
|
|
37
|
-
|
|
37
|
+
addPlayerStat(nil, player, cacheFlag, delta)
|
|
38
38
|
end
|
|
39
39
|
self.callbacksUsed = {{ModCallback.EVALUATE_CACHE, self.evaluateCache}}
|
|
40
40
|
end
|
|
@@ -12,10 +12,10 @@ local Exported = ____decorators.Exported
|
|
|
12
12
|
local ____playerDataStructures = require("src.functions.playerDataStructures")
|
|
13
13
|
local mapGetPlayer = ____playerDataStructures.mapGetPlayer
|
|
14
14
|
local mapSetPlayer = ____playerDataStructures.mapSetPlayer
|
|
15
|
-
local ____playerStats = require("src.functions.playerStats")
|
|
16
|
-
local getPlayerStats = ____playerStats.getPlayerStats
|
|
17
15
|
local ____players = require("src.functions.players")
|
|
18
16
|
local isEden = ____players.isEden
|
|
17
|
+
local ____stats = require("src.functions.stats")
|
|
18
|
+
local getPlayerStats = ____stats.getPlayerStats
|
|
19
19
|
local ____Feature = require("src.classes.private.Feature")
|
|
20
20
|
local Feature = ____Feature.Feature
|
|
21
21
|
local v = {run = {edenPlayerStats = __TS__New(Map)}}
|
|
@@ -52,4 +52,9 @@ export declare function isSuitCard(cardType: CardType): boolean;
|
|
|
52
52
|
export declare function isTarotCard(cardType: CardType): boolean;
|
|
53
53
|
/** Returns true for any vanilla card or rune. */
|
|
54
54
|
export declare function isVanillaCardType(cardType: CardType): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Helper function to use a card without showing an animation and without the announcer voice
|
|
57
|
+
* playing.
|
|
58
|
+
*/
|
|
59
|
+
export declare function useCardTemp(player: EntityPlayer, cardType: CardType): void;
|
|
55
60
|
//# sourceMappingURL=cards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../../src/functions/cards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../../src/functions/cards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAW,MAAM,8BAA8B,CAAC;AAe3E;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgB7D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgBtD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,QAAQ,GACjB,kBAAkB,GAAG,SAAS,CAOhC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,EAAE,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAOlD;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAET;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED,wDAAwD;AACxD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAElD;AAED,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEzD;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEtD;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEvD;AAED,iDAAiD;AACjD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE7D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAG1E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
|
|
4
|
+
local UseFlag = ____isaac_2Dtypescript_2Ddefinitions.UseFlag
|
|
4
5
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
5
6
|
local itemConfig = ____cachedClasses.itemConfig
|
|
6
7
|
local ____constantsFirstLast = require("src.core.constantsFirstLast")
|
|
@@ -14,6 +15,8 @@ local CARD_NAMES = ____cardNames.CARD_NAMES
|
|
|
14
15
|
local DEFAULT_CARD_NAME = ____cardNames.DEFAULT_CARD_NAME
|
|
15
16
|
local ____itemConfigCardTypesForCardsSet = require("src.sets.itemConfigCardTypesForCardsSet")
|
|
16
17
|
local ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = ____itemConfigCardTypesForCardsSet.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET
|
|
18
|
+
local ____flag = require("src.functions.flag")
|
|
19
|
+
local addFlag = ____flag.addFlag
|
|
17
20
|
local ____utils = require("src.functions.utils")
|
|
18
21
|
local iRange = ____utils.iRange
|
|
19
22
|
--- Returns true for any vanilla card or rune.
|
|
@@ -110,4 +113,10 @@ end
|
|
|
110
113
|
function ____exports.isTarotCard(self, cardType)
|
|
111
114
|
return ____exports.isCardType(nil, cardType, ItemConfigCardType.TAROT)
|
|
112
115
|
end
|
|
116
|
+
--- Helper function to use a card without showing an animation and without the announcer voice
|
|
117
|
+
-- playing.
|
|
118
|
+
function ____exports.useCardTemp(self, player, cardType)
|
|
119
|
+
local useFlags = addFlag(nil, UseFlag.NO_ANIMATION, UseFlag.NO_ANNOUNCER_VOICE)
|
|
120
|
+
player:UseCard(cardType, useFlags)
|
|
121
|
+
end
|
|
113
122
|
return ____exports
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CacheFlag } from "isaac-typescript-definitions";
|
|
2
|
+
import { PlayerStat } from "../enums/PlayerStat";
|
|
3
|
+
import type { PlayerStats } from "../interfaces/PlayerStats";
|
|
2
4
|
/**
|
|
3
5
|
* Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
|
|
4
6
|
* from the `EVALUATE_CACHE` callback.
|
|
@@ -14,7 +16,7 @@ import { CacheFlag } from "isaac-typescript-definitions";
|
|
|
14
16
|
* - CacheFlag.SPEED (1 << 4)
|
|
15
17
|
* - CacheFlag.LUCK (1 << 10)
|
|
16
18
|
*/
|
|
17
|
-
export declare function
|
|
19
|
+
export declare function addPlayerStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
|
|
18
20
|
/**
|
|
19
21
|
* Returns the starting stat that Isaac (the default character) starts with. For example, if you
|
|
20
22
|
* pass this function `CacheFlag.DAMAGE`, it will return 3.5.
|
|
@@ -22,4 +24,8 @@ export declare function addStat(player: EntityPlayer, cacheFlag: CacheFlag, amou
|
|
|
22
24
|
* Note that the default fire delay is represented in the tear stat, not the `MaxFireDelay` value.
|
|
23
25
|
*/
|
|
24
26
|
export declare function getDefaultPlayerStat(cacheFlag: CacheFlag): number | undefined;
|
|
27
|
+
/** Helper function to get the stat for a player corresponding to the `StatType`. */
|
|
28
|
+
export declare function getPlayerStat<T extends PlayerStat>(player: EntityPlayer, playerStat: T): PlayerStats[T];
|
|
29
|
+
/** Helper function to get all of the stat for a player. */
|
|
30
|
+
export declare function getPlayerStats(player: EntityPlayer): PlayerStats;
|
|
25
31
|
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/functions/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/functions/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAc7D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,IAAI,CA4CN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7E;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,CAAC,SAAS,UAAU,EAChD,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,CAAC,GACZ,WAAW,CAAC,CAAC,CAAC,CAGhB;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAgBhE"}
|
|
@@ -3,12 +3,32 @@ local __TS__New = ____lualib.__TS__New
|
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
5
5
|
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
6
|
+
local ____PlayerStat = require("src.enums.PlayerStat")
|
|
7
|
+
local PlayerStat = ____PlayerStat.PlayerStat
|
|
6
8
|
local ____defaultPlayerStatMap = require("src.maps.defaultPlayerStatMap")
|
|
7
9
|
local DEFAULT_PLAYER_STAT_MAP = ____defaultPlayerStatMap.DEFAULT_PLAYER_STAT_MAP
|
|
8
10
|
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
9
11
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
10
12
|
local ____tears = require("src.functions.tears")
|
|
11
13
|
local addTearsStat = ____tears.addTearsStat
|
|
14
|
+
--- Helper function to get all of the stat for a player.
|
|
15
|
+
function ____exports.getPlayerStats(self, player)
|
|
16
|
+
return {
|
|
17
|
+
[PlayerStat.DAMAGE] = player.Damage,
|
|
18
|
+
[PlayerStat.FIRE_DELAY] = player.MaxFireDelay,
|
|
19
|
+
[PlayerStat.SHOT_SPEED] = player.ShotSpeed,
|
|
20
|
+
[PlayerStat.TEAR_HEIGHT] = player.TearHeight,
|
|
21
|
+
[PlayerStat.TEAR_RANGE] = player.TearRange,
|
|
22
|
+
[PlayerStat.TEAR_FALLING_ACCELERATION] = player.TearFallingAcceleration,
|
|
23
|
+
[PlayerStat.TEAR_FALLING_SPEED] = player.TearFallingSpeed,
|
|
24
|
+
[PlayerStat.MOVE_SPEED] = player.MoveSpeed,
|
|
25
|
+
[PlayerStat.TEAR_FLAG] = player.TearFlags,
|
|
26
|
+
[PlayerStat.TEAR_COLOR] = player.TearColor,
|
|
27
|
+
[PlayerStat.FLYING] = player.CanFly,
|
|
28
|
+
[PlayerStat.LUCK] = player.Luck,
|
|
29
|
+
[PlayerStat.SIZE] = player.SpriteScale
|
|
30
|
+
}
|
|
31
|
+
end
|
|
12
32
|
local STAT_CACHE_FLAGS_SET = __TS__New(ReadonlySet, {
|
|
13
33
|
CacheFlag.DAMAGE,
|
|
14
34
|
CacheFlag.FIRE_DELAY,
|
|
@@ -30,7 +50,7 @@ local STAT_CACHE_FLAGS_SET = __TS__New(ReadonlySet, {
|
|
|
30
50
|
-- - CacheFlag.RANGE (1 << 3)
|
|
31
51
|
-- - CacheFlag.SPEED (1 << 4)
|
|
32
52
|
-- - CacheFlag.LUCK (1 << 10)
|
|
33
|
-
function ____exports.
|
|
53
|
+
function ____exports.addPlayerStat(self, player, cacheFlag, amount)
|
|
34
54
|
if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
|
|
35
55
|
error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
|
|
36
56
|
end
|
|
@@ -87,4 +107,9 @@ end
|
|
|
87
107
|
function ____exports.getDefaultPlayerStat(self, cacheFlag)
|
|
88
108
|
return DEFAULT_PLAYER_STAT_MAP:get(cacheFlag)
|
|
89
109
|
end
|
|
110
|
+
--- Helper function to get the stat for a player corresponding to the `StatType`.
|
|
111
|
+
function ____exports.getPlayerStat(self, player, playerStat)
|
|
112
|
+
local playerStats = ____exports.getPlayerStats(nil, player)
|
|
113
|
+
return playerStats[playerStat]
|
|
114
|
+
end
|
|
90
115
|
return ____exports
|
package/dist/src/index.d.ts
CHANGED
|
@@ -87,7 +87,6 @@ export * from "./functions/playerCenter";
|
|
|
87
87
|
export * from "./functions/playerDataStructures";
|
|
88
88
|
export * from "./functions/playerHealth";
|
|
89
89
|
export * from "./functions/playerIndex";
|
|
90
|
-
export * from "./functions/playerStats";
|
|
91
90
|
export * from "./functions/players";
|
|
92
91
|
export * from "./functions/pocketItems";
|
|
93
92
|
export * from "./functions/positionVelocity";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CA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AAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
package/dist/src/index.lua
CHANGED
|
@@ -711,14 +711,6 @@ do
|
|
|
711
711
|
end
|
|
712
712
|
end
|
|
713
713
|
end
|
|
714
|
-
do
|
|
715
|
-
local ____export = require("src.functions.playerStats")
|
|
716
|
-
for ____exportKey, ____exportValue in pairs(____export) do
|
|
717
|
-
if ____exportKey ~= "default" then
|
|
718
|
-
____exports[____exportKey] = ____exportValue
|
|
719
|
-
end
|
|
720
|
-
end
|
|
721
|
-
end
|
|
722
714
|
do
|
|
723
715
|
local ____export = require("src.functions.players")
|
|
724
716
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerStats.d.ts","sourceRoot":"","sources":["../../../src/interfaces/PlayerStats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"PlayerStats.d.ts","sourceRoot":"","sources":["../../../src/interfaces/PlayerStats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IAC3B,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAC/B,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAC/B,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAChC,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAC/B,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAAE,KAAK,CAAC;IAC9C,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC;IACvC,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAC/B,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAC/B,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC7B,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACzB,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.11.1",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"main": "dist/src/index",
|
|
26
26
|
"types": "dist/index.rollup.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^13.0.
|
|
28
|
+
"isaac-typescript-definitions": "^13.0.36"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -4,7 +4,7 @@ import type { PlayerStat } from "../../enums/PlayerStat";
|
|
|
4
4
|
import { isBitSet128 } from "../../functions/bitSet128";
|
|
5
5
|
import { colorEquals, isColor } from "../../functions/color";
|
|
6
6
|
import { getPlayerIndex } from "../../functions/playerIndex";
|
|
7
|
-
import { getPlayerStat } from "../../functions/
|
|
7
|
+
import { getPlayerStat } from "../../functions/stats";
|
|
8
8
|
import { isBoolean, isNumber } from "../../functions/types";
|
|
9
9
|
import { isVector, vectorEquals } from "../../functions/vector";
|
|
10
10
|
import { shouldFirePlayer } from "../../shouldFire";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CacheFlag, PlayerType } from "isaac-typescript-definitions";
|
|
2
2
|
import { ModCallback } from "isaac-typescript-definitions";
|
|
3
3
|
import { Exported } from "../../../decorators";
|
|
4
|
-
import {
|
|
4
|
+
import { addPlayerStat, getDefaultPlayerStat } from "../../../functions/stats";
|
|
5
5
|
import { Feature } from "../../private/Feature";
|
|
6
6
|
|
|
7
7
|
type StatMap = Map<CacheFlag, number> | ReadonlyMap<CacheFlag, number>;
|
|
@@ -38,7 +38,7 @@ export class CharacterStats extends Feature {
|
|
|
38
38
|
}
|
|
39
39
|
const delta = stat - defaultStat;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
addPlayerStat(player, cacheFlag, delta);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
mapGetPlayer,
|
|
6
6
|
mapSetPlayer,
|
|
7
7
|
} from "../../../functions/playerDataStructures";
|
|
8
|
-
import { getPlayerStats } from "../../../functions/playerStats";
|
|
9
8
|
import { isEden } from "../../../functions/players";
|
|
9
|
+
import { getPlayerStats } from "../../../functions/stats";
|
|
10
10
|
import type { PlayerStats } from "../../../interfaces/PlayerStats";
|
|
11
11
|
import type { PlayerIndex } from "../../../types/PlayerIndex";
|
|
12
12
|
import { Feature } from "../../private/Feature";
|
package/src/functions/cards.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CardType } from "isaac-typescript-definitions";
|
|
2
|
-
import { ItemConfigCardType } from "isaac-typescript-definitions";
|
|
2
|
+
import { ItemConfigCardType, UseFlag } from "isaac-typescript-definitions";
|
|
3
3
|
import { itemConfig } from "../core/cachedClasses";
|
|
4
4
|
import {
|
|
5
5
|
FIRST_CARD_TYPE,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "../objects/cardDescriptions";
|
|
12
12
|
import { CARD_NAMES, DEFAULT_CARD_NAME } from "../objects/cardNames";
|
|
13
13
|
import { ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET } from "../sets/itemConfigCardTypesForCardsSet";
|
|
14
|
+
import { addFlag } from "./flag";
|
|
14
15
|
import { iRange } from "./utils";
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -149,3 +150,12 @@ export function isTarotCard(cardType: CardType): boolean {
|
|
|
149
150
|
export function isVanillaCardType(cardType: CardType): boolean {
|
|
150
151
|
return cardType <= LAST_VANILLA_CARD_TYPE;
|
|
151
152
|
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Helper function to use a card without showing an animation and without the announcer voice
|
|
156
|
+
* playing.
|
|
157
|
+
*/
|
|
158
|
+
export function useCardTemp(player: EntityPlayer, cardType: CardType): void {
|
|
159
|
+
const useFlags = addFlag(UseFlag.NO_ANIMATION, UseFlag.NO_ANNOUNCER_VOICE);
|
|
160
|
+
player.UseCard(cardType, useFlags);
|
|
161
|
+
}
|
package/src/functions/stats.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CacheFlag } from "isaac-typescript-definitions";
|
|
2
|
+
import { PlayerStat } from "../enums/PlayerStat";
|
|
3
|
+
import type { PlayerStats } from "../interfaces/PlayerStats";
|
|
2
4
|
import { DEFAULT_PLAYER_STAT_MAP } from "../maps/defaultPlayerStatMap";
|
|
3
5
|
import { ReadonlySet } from "../types/ReadonlySet";
|
|
4
6
|
import { addTearsStat } from "./tears";
|
|
@@ -27,7 +29,7 @@ const STAT_CACHE_FLAGS_SET = new ReadonlySet<CacheFlag>([
|
|
|
27
29
|
* - CacheFlag.SPEED (1 << 4)
|
|
28
30
|
* - CacheFlag.LUCK (1 << 10)
|
|
29
31
|
*/
|
|
30
|
-
export function
|
|
32
|
+
export function addPlayerStat(
|
|
31
33
|
player: EntityPlayer,
|
|
32
34
|
cacheFlag: CacheFlag,
|
|
33
35
|
amount: number,
|
|
@@ -86,3 +88,31 @@ export function addStat(
|
|
|
86
88
|
export function getDefaultPlayerStat(cacheFlag: CacheFlag): number | undefined {
|
|
87
89
|
return DEFAULT_PLAYER_STAT_MAP.get(cacheFlag);
|
|
88
90
|
}
|
|
91
|
+
|
|
92
|
+
/** Helper function to get the stat for a player corresponding to the `StatType`. */
|
|
93
|
+
export function getPlayerStat<T extends PlayerStat>(
|
|
94
|
+
player: EntityPlayer,
|
|
95
|
+
playerStat: T,
|
|
96
|
+
): PlayerStats[T] {
|
|
97
|
+
const playerStats = getPlayerStats(player);
|
|
98
|
+
return playerStats[playerStat];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Helper function to get all of the stat for a player. */
|
|
102
|
+
export function getPlayerStats(player: EntityPlayer): PlayerStats {
|
|
103
|
+
return {
|
|
104
|
+
[PlayerStat.DAMAGE]: player.Damage, // 1 << 0
|
|
105
|
+
[PlayerStat.FIRE_DELAY]: player.MaxFireDelay, // 1 << 1
|
|
106
|
+
[PlayerStat.SHOT_SPEED]: player.ShotSpeed, // 1 << 2
|
|
107
|
+
[PlayerStat.TEAR_HEIGHT]: player.TearHeight, // 1 << 3
|
|
108
|
+
[PlayerStat.TEAR_RANGE]: player.TearRange, // 1 << 3
|
|
109
|
+
[PlayerStat.TEAR_FALLING_ACCELERATION]: player.TearFallingAcceleration, // 1 << 3
|
|
110
|
+
[PlayerStat.TEAR_FALLING_SPEED]: player.TearFallingSpeed, // 1 << 3
|
|
111
|
+
[PlayerStat.MOVE_SPEED]: player.MoveSpeed, // 1 << 4
|
|
112
|
+
[PlayerStat.TEAR_FLAG]: player.TearFlags, // 1 << 5
|
|
113
|
+
[PlayerStat.TEAR_COLOR]: player.TearColor, // 1 << 6
|
|
114
|
+
[PlayerStat.FLYING]: player.CanFly, // 1 << 7
|
|
115
|
+
[PlayerStat.LUCK]: player.Luck, // 1 << 10
|
|
116
|
+
[PlayerStat.SIZE]: player.SpriteScale, // 1 << 11
|
|
117
|
+
};
|
|
118
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -87,7 +87,6 @@ export * from "./functions/playerCenter";
|
|
|
87
87
|
export * from "./functions/playerDataStructures";
|
|
88
88
|
export * from "./functions/playerHealth";
|
|
89
89
|
export * from "./functions/playerIndex";
|
|
90
|
-
export * from "./functions/playerStats";
|
|
91
90
|
export * from "./functions/players";
|
|
92
91
|
export * from "./functions/pocketItems";
|
|
93
92
|
export * from "./functions/positionVelocity";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TearFlag } from "isaac-typescript-definitions";
|
|
2
2
|
import type { PlayerStat } from "../enums/PlayerStat";
|
|
3
|
+
import { validateInterfaceMatchesEnum } from "../functions/enums";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Contains every player stat along with its corresponding data type. For example, `StatType.DAMAGE`
|
|
@@ -20,3 +21,5 @@ export interface PlayerStats {
|
|
|
20
21
|
[PlayerStat.LUCK]: float;
|
|
21
22
|
[PlayerStat.SIZE]: Vector;
|
|
22
23
|
}
|
|
24
|
+
|
|
25
|
+
validateInterfaceMatchesEnum<PlayerStats, PlayerStat>();
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
import { PlayerStat } from "../enums/PlayerStat";
|
|
3
|
-
import type { PlayerStats } from "../interfaces/PlayerStats";
|
|
4
|
-
/** Helper function to get the stat for a player corresponding to the `StatType`. */
|
|
5
|
-
export declare function getPlayerStat<T extends PlayerStat>(player: EntityPlayer, playerStat: T): PlayerStats[T];
|
|
6
|
-
/** Helper function to get all of the stat for a player. */
|
|
7
|
-
export declare function getPlayerStats(player: EntityPlayer): PlayerStats;
|
|
8
|
-
//# sourceMappingURL=playerStats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playerStats.d.ts","sourceRoot":"","sources":["../../../src/functions/playerStats.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,CAAC,SAAS,UAAU,EAChD,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,CAAC,GACZ,WAAW,CAAC,CAAC,CAAC,CAGhB;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAgBhE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
local ____exports = {}
|
|
2
|
-
local ____PlayerStat = require("src.enums.PlayerStat")
|
|
3
|
-
local PlayerStat = ____PlayerStat.PlayerStat
|
|
4
|
-
--- Helper function to get all of the stat for a player.
|
|
5
|
-
function ____exports.getPlayerStats(self, player)
|
|
6
|
-
return {
|
|
7
|
-
[PlayerStat.DAMAGE] = player.Damage,
|
|
8
|
-
[PlayerStat.FIRE_DELAY] = player.MaxFireDelay,
|
|
9
|
-
[PlayerStat.SHOT_SPEED] = player.ShotSpeed,
|
|
10
|
-
[PlayerStat.TEAR_HEIGHT] = player.TearHeight,
|
|
11
|
-
[PlayerStat.TEAR_RANGE] = player.TearRange,
|
|
12
|
-
[PlayerStat.TEAR_FALLING_ACCELERATION] = player.TearFallingAcceleration,
|
|
13
|
-
[PlayerStat.TEAR_FALLING_SPEED] = player.TearFallingSpeed,
|
|
14
|
-
[PlayerStat.MOVE_SPEED] = player.MoveSpeed,
|
|
15
|
-
[PlayerStat.TEAR_FLAG] = player.TearFlags,
|
|
16
|
-
[PlayerStat.TEAR_COLOR] = player.TearColor,
|
|
17
|
-
[PlayerStat.FLYING] = player.CanFly,
|
|
18
|
-
[PlayerStat.LUCK] = player.Luck,
|
|
19
|
-
[PlayerStat.SIZE] = player.SpriteScale
|
|
20
|
-
}
|
|
21
|
-
end
|
|
22
|
-
--- Helper function to get the stat for a player corresponding to the `StatType`.
|
|
23
|
-
function ____exports.getPlayerStat(self, player, playerStat)
|
|
24
|
-
local playerStats = ____exports.getPlayerStats(nil, player)
|
|
25
|
-
return playerStats[playerStat]
|
|
26
|
-
end
|
|
27
|
-
return ____exports
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { PlayerStat } from "../enums/PlayerStat";
|
|
2
|
-
import type { PlayerStats } from "../interfaces/PlayerStats";
|
|
3
|
-
|
|
4
|
-
/** Helper function to get the stat for a player corresponding to the `StatType`. */
|
|
5
|
-
export function getPlayerStat<T extends PlayerStat>(
|
|
6
|
-
player: EntityPlayer,
|
|
7
|
-
playerStat: T,
|
|
8
|
-
): PlayerStats[T] {
|
|
9
|
-
const playerStats = getPlayerStats(player);
|
|
10
|
-
return playerStats[playerStat];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** Helper function to get all of the stat for a player. */
|
|
14
|
-
export function getPlayerStats(player: EntityPlayer): PlayerStats {
|
|
15
|
-
return {
|
|
16
|
-
[PlayerStat.DAMAGE]: player.Damage, // 1 << 0
|
|
17
|
-
[PlayerStat.FIRE_DELAY]: player.MaxFireDelay, // 1 << 1
|
|
18
|
-
[PlayerStat.SHOT_SPEED]: player.ShotSpeed, // 1 << 2
|
|
19
|
-
[PlayerStat.TEAR_HEIGHT]: player.TearHeight, // 1 << 3
|
|
20
|
-
[PlayerStat.TEAR_RANGE]: player.TearRange, // 1 << 3
|
|
21
|
-
[PlayerStat.TEAR_FALLING_ACCELERATION]: player.TearFallingAcceleration, // 1 << 3
|
|
22
|
-
[PlayerStat.TEAR_FALLING_SPEED]: player.TearFallingSpeed, // 1 << 3
|
|
23
|
-
[PlayerStat.MOVE_SPEED]: player.MoveSpeed, // 1 << 4
|
|
24
|
-
[PlayerStat.TEAR_FLAG]: player.TearFlags, // 1 << 5
|
|
25
|
-
[PlayerStat.TEAR_COLOR]: player.TearColor, // 1 << 6
|
|
26
|
-
[PlayerStat.FLYING]: player.CanFly, // 1 << 7
|
|
27
|
-
[PlayerStat.LUCK]: player.Luck, // 1 << 10
|
|
28
|
-
[PlayerStat.SIZE]: player.SpriteScale, // 1 << 11
|
|
29
|
-
};
|
|
30
|
-
}
|