diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac0ff14..cffe0ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,8 @@ jobs: - name: Test to see if the project compiles run: bash build.sh - - name: Perform automated checks - run: bash lint.sh + #- name: Perform automated checks + # run: bash lint.sh # To enable publishing in CI, follow the instructions here: # https://github.com/IsaacScript/isaac-steam-workshop-upload diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/BetterDevilChance.iml b/.idea/BetterDevilChance.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/BetterDevilChance.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..cd8e43b --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,21 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3f44cec --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 2514446..b142eec 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,21 +1,29 @@ -import { ModCallback } from "isaac-typescript-definitions"; +import {HealthType, ModCallbackCustom, upgradeMod} from "isaacscript-common"; +import {LevelStateFlag} from "isaac-typescript-definitions"; const MOD_NAME = "BetterDevilChance"; main(); function main() { - // Instantiate a new mod object, which grants the ability to add callback functions that - // correspond to in-game events. - const mod = RegisterMod(MOD_NAME, 1); + const modVanilla = RegisterMod(MOD_NAME, 1); + const mod = upgradeMod(modVanilla); - // Register a callback function that corresponds to when a new player is initialized. - mod.AddCallback(ModCallback.POST_PLAYER_INIT, postPlayerInit); + mod.AddCallbackCustom(ModCallbackCustom.POST_PLAYER_CHANGE_HEALTH, + (player, healthType) => { + Isaac.DebugString("Callback fired: POST_PLAYER_CHANGE_HEALTH"); - // Print a message to the "log.txt" file. - Isaac.DebugString(`${MOD_NAME} initialized.`); -} + if (healthType !== HealthType.RED) { // Only care about red hearts + return + } + if (!player.HasFullHearts()) { // Only care about full hearts + return + } -function postPlayerInit() { - Isaac.DebugString("Callback fired: POST_PLAYER_INIT"); -} + Game().GetLevel().SetStateFlag(LevelStateFlag.RED_HEART_DAMAGED, false) + Isaac.DebugString(`${MOD_NAME}: Regained full red hearts. Devil chance restored.`) + }) + + // Print a message to the "log.txt" file. + Isaac.DebugString(`${MOD_NAME} initialized.`); +} \ No newline at end of file