Skip to content

Commit

Permalink
Formatted some files, cleaned up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Math-Man committed Nov 9, 2024
1 parent f40e067 commit ffc5679
Show file tree
Hide file tree
Showing 19 changed files with 393 additions and 395 deletions.
38 changes: 19 additions & 19 deletions src/callbacks/MCEntityTakeDamage.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { ModCallback } from "isaac-typescript-definitions";
import { DamageFlagsCustom } from "../enums/DamageFlagsCustom";
import { playerHasSamuraisBladeItem } from "../helpers/Helpers";
import { SamuraiBladeEntityDamage } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {DamageFlagsCustom} from "../enums/DamageFlagsCustom";
import {playerHasSamuraisBladeItem} from "../helpers/Helpers";
import {SamuraiBladeEntityDamage} from "../items/SamuraisBlade";

export function entityTakeDamageInit(mod: Mod): void {
mod.AddCallback(ModCallback.ENTITY_TAKE_DMG, entityTakeDamageMain);
mod.AddCallback(ModCallback.ENTITY_TAKE_DMG, entityTakeDamageMain);
}

function entityTakeDamageMain(
tookDamage: Entity,
damageAmount: number,
damageFlags: BitFlag,
damageSource: EntityRef,
damageCountdownFrames: number,
tookDamage: Entity,
damageAmount: number,
damageFlags: BitFlag,
damageSource: EntityRef,
damageCountdownFrames: number,
): boolean | undefined {
const player = damageSource.Entity?.ToPlayer();
const player = damageSource.Entity?.ToPlayer();

// flog(`Extending berserk! ${player} ${tookDamage.HasMortalDamage()}}`);
// if (player) {
// extendBerserk(player);
// }
// flog(`Extending berserk! ${player} ${tookDamage.HasMortalDamage()}}`);
// if (player) {
// extendBerserk(player);
// }

if (player !== undefined && playerHasSamuraisBladeItem(player) && tookDamage.IsVulnerableEnemy() && damageFlags === DamageFlagsCustom.SB_BLADE_DAMAGE) {
SamuraiBladeEntityDamage(tookDamage, damageAmount, damageFlags, damageSource, damageCountdownFrames);
}
return undefined;
if (player !== undefined && playerHasSamuraisBladeItem(player) && tookDamage.IsVulnerableEnemy() && damageFlags === DamageFlagsCustom.SB_BLADE_DAMAGE) {
SamuraiBladeEntityDamage(tookDamage, damageAmount, damageFlags, damageSource, damageCountdownFrames);
}
return undefined;
}
20 changes: 10 additions & 10 deletions src/callbacks/MCEvaluateCache.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { CacheFlag, ModCallback } from "isaac-typescript-definitions";
import { getPlayerStateDataNoCreate } from "../data/StateData";
import { flog } from "../helpers/DebugHelper";
import { playerHasSamuraisBladeItem } from "../helpers/Helpers";
import { SamuraiBladeEvalCache } from "../items/SamuraisBlade";
import {CacheFlag, ModCallback} from "isaac-typescript-definitions";
import {getPlayerStateDataNoCreate} from "../data/StateData";
import {flog} from "../helpers/DebugHelper";
import {playerHasSamuraisBladeItem} from "../helpers/Helpers";
import {SamuraiBladeEvalCache} from "../items/SamuraisBlade";

const LOG_ID = "MCEvaluateCache";

export function evaluateCacheInit(mod: Mod): void {
mod.AddCallback(ModCallback.EVALUATE_CACHE, main);
mod.AddCallback(ModCallback.EVALUATE_CACHE, main);
}

function main(player: EntityPlayer, cacheFlag: CacheFlag) {
if (cacheFlag === CacheFlag.LUCK && getPlayerStateDataNoCreate(player) === undefined && playerHasSamuraisBladeItem(player)) {
flog("Player is now motivated", LOG_ID);
SamuraiBladeEvalCache(player, cacheFlag);
}
if (cacheFlag === CacheFlag.LUCK && getPlayerStateDataNoCreate(player) === undefined && playerHasSamuraisBladeItem(player)) {
flog("Player is now motivated", LOG_ID);
SamuraiBladeEvalCache(player, cacheFlag);
}
}
12 changes: 6 additions & 6 deletions src/callbacks/MCPostCollectibleRemoved.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CollectibleType } from "isaac-typescript-definitions";
import { ModCallbackCustom, ModUpgraded } from "isaacscript-common";
import { CollectibleTypeCustom } from "../enums/CollectibleTypeCustom";
import { infoLog } from "../helpers/DebugHelper";
import {CollectibleType} from "isaac-typescript-definitions";
import {ModCallbackCustom, ModUpgraded} from "isaacscript-common";
import {CollectibleTypeCustom} from "../enums/CollectibleTypeCustom";
import {infoLog} from "../helpers/DebugHelper";

export function postCollectibleRemoved(mod: ModUpgraded): void {
mod.AddCallbackCustom(ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED, main, CollectibleTypeCustom.SB_SAMURAI_BLADE);
mod.AddCallbackCustom(ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED, main, CollectibleTypeCustom.SB_SAMURAI_BLADE);
}

function main(player: EntityPlayer, collectibleType: CollectibleType) {
infoLog(`Item is gone, this is so sad. so sad indeed... ${collectibleType} `);
infoLog(`Item is gone, this is so sad. so sad indeed... ${collectibleType} `);
}
14 changes: 7 additions & 7 deletions src/callbacks/MCPostGameStarted.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ModCallback } from "isaac-typescript-definitions";
import { ModUpgraded } from "isaacscript-common";
import { SamuraiBladePostGameStarted } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {ModUpgraded} from "isaacscript-common";
import {SamuraiBladePostGameStarted} from "../items/SamuraisBlade";

export function postGameStartedInit(mod: ModUpgraded): void {
mod.AddCallback(ModCallback.POST_GAME_STARTED, () => {
main(mod);
});
mod.AddCallback(ModCallback.POST_GAME_STARTED, () => {
main(mod);
});
}

function main(mod: ModUpgraded) {
SamuraiBladePostGameStarted(mod);
SamuraiBladePostGameStarted(mod);
}
30 changes: 13 additions & 17 deletions src/callbacks/MCPostItemPickup.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import { ItemType } from "isaac-typescript-definitions";
import {
ModCallbackCustom,
ModUpgraded,
PickingUpItem,
} from "isaacscript-common";
import { CollectibleTypeCustom } from "../enums/CollectibleTypeCustom";
import { flog } from "../helpers/DebugHelper";
import { SamuraiBladePostPickup } from "../items/SamuraisBlade";
import {ItemType} from "isaac-typescript-definitions";
import {ModCallbackCustom, ModUpgraded, PickingUpItem,} from "isaacscript-common";
import {CollectibleTypeCustom} from "../enums/CollectibleTypeCustom";
import {flog} from "../helpers/DebugHelper";
import {SamuraiBladePostPickup} from "../items/SamuraisBlade";

export function postItemPickupInit(mod: ModUpgraded): void {
mod.AddCallbackCustom(
ModCallbackCustom.POST_ITEM_PICKUP,
main,
ItemType.PASSIVE,
CollectibleTypeCustom.SB_SAMURAI_BLADE,
);
mod.AddCallbackCustom(
ModCallbackCustom.POST_ITEM_PICKUP,
main,
ItemType.PASSIVE,
CollectibleTypeCustom.SB_SAMURAI_BLADE,
);
}

function main(player: EntityPlayer, pickingUpItem: PickingUpItem) {
flog("Item:" + pickingUpItem, "CALLBACK");
SamuraiBladePostPickup(player);
flog("Item:" + pickingUpItem, "CALLBACK");
SamuraiBladePostPickup(player);
}
8 changes: 4 additions & 4 deletions src/callbacks/MCPostNewRoom.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ModCallback } from "isaac-typescript-definitions";
import { SamuraiBladePostNewRoom } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {SamuraiBladePostNewRoom} from "../items/SamuraisBlade";

export function postNewRoomInit(mod: Mod): void {
mod.AddCallback(ModCallback.POST_NEW_ROOM, main);
mod.AddCallback(ModCallback.POST_NEW_ROOM, main);
}

function main() {
SamuraiBladePostNewRoom();
SamuraiBladePostNewRoom();
}
4 changes: 2 additions & 2 deletions src/callbacks/MCPostPlayerInit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ModCallback } from "isaac-typescript-definitions";
import {ModCallback} from "isaac-typescript-definitions";

export function postPlayerInit(mod: Mod): void {
mod.AddCallback(ModCallback.POST_PLAYER_INIT, main);
mod.AddCallback(ModCallback.POST_PLAYER_INIT, main);
}

function main() {
Expand Down
12 changes: 6 additions & 6 deletions src/callbacks/MCPostRender.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ModCallback } from "isaac-typescript-definitions";
import { renderHudForPlayers } from "../items/samuraiBlade/hud/HudRenderer";
import { SamuraiBladePostRender } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {renderHudForPlayers} from "../items/samuraiBlade/hud/HudRenderer";
import {SamuraiBladePostRender} from "../items/SamuraisBlade";

export function postRenderInit(mod: Mod): void {
mod.AddCallback(ModCallback.POST_RENDER, main);
mod.AddCallback(ModCallback.POST_RENDER, main);
}

function main() {
SamuraiBladePostRender();
SamuraiBladePostRender();

renderHudForPlayers();
renderHudForPlayers();
}
8 changes: 4 additions & 4 deletions src/callbacks/MCPostRenderPickup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ModCallback } from "isaac-typescript-definitions";
import { SamuraiBladePostRenderPickup } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {SamuraiBladePostRenderPickup} from "../items/SamuraisBlade";

export function postRenderPickupInit(mod: Mod): void {
mod.AddCallback(ModCallback.POST_PICKUP_RENDER, main);
mod.AddCallback(ModCallback.POST_PICKUP_RENDER, main);
}

function main() {
SamuraiBladePostRenderPickup();
SamuraiBladePostRenderPickup();
}
8 changes: 4 additions & 4 deletions src/callbacks/MCPostRenderPlayer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ModCallback } from "isaac-typescript-definitions";
import { SamuraiBladePostRenderPlayer } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {SamuraiBladePostRenderPlayer} from "../items/SamuraisBlade";

export function postRenderPlayerInit(mod: Mod): void {
mod.AddCallback(ModCallback.POST_PLAYER_RENDER, main);
mod.AddCallback(ModCallback.POST_PLAYER_RENDER, main);
}

function main() {
SamuraiBladePostRenderPlayer();
SamuraiBladePostRenderPlayer();
}
8 changes: 4 additions & 4 deletions src/callbacks/MCPostTearUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ModCallback } from "isaac-typescript-definitions";
import { SamuraiBladePostTearUpdate } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {SamuraiBladePostTearUpdate} from "../items/SamuraisBlade";

export function postTearUpdateInit(mod: Mod): void {
mod.AddCallback(ModCallback.POST_TEAR_UPDATE, main);
mod.AddCallback(ModCallback.POST_TEAR_UPDATE, main);
}

function main(tear: EntityTear) {
SamuraiBladePostTearUpdate(tear);
SamuraiBladePostTearUpdate(tear);
}
8 changes: 4 additions & 4 deletions src/callbacks/MCPostUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ModCallback } from "isaac-typescript-definitions";
import { SamuraiBladePostUpdate } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {SamuraiBladePostUpdate} from "../items/SamuraisBlade";

export function postUpdateInit(mod: Mod): void {
mod.AddCallback(ModCallback.POST_UPDATE, main);
mod.AddCallback(ModCallback.POST_UPDATE, main);
}

function main() {
SamuraiBladePostUpdate();
SamuraiBladePostUpdate();
}
14 changes: 7 additions & 7 deletions src/callbacks/MCPreGameExit.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ModCallback } from "isaac-typescript-definitions";
import { ModUpgraded } from "isaacscript-common";
import { SamuraiBladePreGameExit } from "../items/SamuraisBlade";
import {ModCallback} from "isaac-typescript-definitions";
import {ModUpgraded} from "isaacscript-common";
import {SamuraiBladePreGameExit} from "../items/SamuraisBlade";

export function preGameExitInit(mod: ModUpgraded): void {
mod.AddCallback(ModCallback.PRE_GAME_EXIT, () => {
main(mod);
});
mod.AddCallback(ModCallback.PRE_GAME_EXIT, () => {
main(mod);
});
}

function main(mod: ModUpgraded) {
SamuraiBladePreGameExit(mod);
SamuraiBladePreGameExit(mod);
}
Loading

0 comments on commit ffc5679

Please sign in to comment.