Skip to content

Commit facd748

Browse files
committed
Fix commit screw up
1 parent 3d11ff2 commit facd748

1 file changed

Lines changed: 16 additions & 40 deletions

File tree

src/characters/Miku/MikuTaintedCharacter.ts

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
CollectibleType,
77
EffectVariant,
88
EntityCollisionClass,
9-
EntityFlag,
109
ModCallback,
1110
PickupVariant,
1211
PlayerVariant,
@@ -15,11 +14,10 @@ import {
1514
import type { PlayerIndex, SaveData } from "isaacscript-common";
1615
import {
1716
addCollectibleCostume,
17+
anyPlayerIs,
1818
Callback,
1919
CallbackCustom,
2020
getPlayerFromEntity,
21-
getPlayerFromIndex,
22-
getPlayerIndex,
2321
getPlayersOfType,
2422
getRandom,
2523
isActiveEnemy,
@@ -492,10 +490,6 @@ export class MikuTaintedCharacter extends Character {
492490
}
493491
}
494492

495-
if (!entity.HasEntityFlags(EntityFlag.NO_REWARD)) {
496-
this.npcLastHitPlayer.set(entity.InitSeed, getPlayerIndex(player));
497-
}
498-
499493
return true;
500494
}
501495

@@ -508,58 +502,45 @@ export class MikuTaintedCharacter extends Character {
508502
*/
509503
@Callback(ModCallback.POST_NPC_DEATH)
510504
override postNPCDeath(npc: EntityNPC): void {
511-
const lastHit = this.npcLastHitPlayer.get(npc.InitSeed);
512-
this.npcLastHitPlayer.delete(npc.InitSeed);
513-
514-
if (lastHit === undefined) {
505+
if (!anyPlayerIs(PlayerTypeCustom.MIKU_B) || !npc.IsEnemy()) {
515506
return;
516507
}
517508

518-
const player = getPlayerFromIndex(lastHit);
519-
if (!player || !isMiku(player, true) || !npc.IsEnemy()) {
520-
return;
509+
const unlocked = new Set<NotePickupSubType>();
510+
511+
for (const player of getPlayersOfType(PlayerTypeCustom.MIKU_B)) {
512+
const data = getData<TaintedMikuData>(player);
513+
for (const note of data.unlockedNotes ?? []) {
514+
unlocked.add(note);
515+
}
521516
}
522517

523-
const playerData = getData<TaintedMikuData>(player);
524-
const unlocked = playerData.unlockedNotes ?? [];
518+
const unlockedArray = [...unlocked];
519+
520+
print(unlockedArray);
525521

526522
const baseNotes = Object.values(NotePickupSubType).filter(
527523
(v): v is NotePickupSubType =>
528524
typeof v === "number" && NOTE_TYPE_DATA[v].weight > 0,
529525
);
530526

531-
const noteSubTypes: NotePickupSubType[] = [
527+
const noteSubTypes = [
532528
...baseNotes,
533-
...unlocked.filter((n) => !baseNotes.includes(n)),
529+
...unlockedArray.filter((n) => !baseNotes.includes(n)),
534530
];
535531

536532
const weights = noteSubTypes.map((s) =>
537-
unlocked.includes(s) ? 2 : NOTE_TYPE_DATA[s].weight,
538-
);
539-
540-
print(
541-
`POOL: ${noteSubTypes.map((s) => NOTE_TYPE_DATA[s].name).join(", ")}`,
533+
unlockedArray.includes(s) ? 2 : NOTE_TYPE_DATA[s].weight,
542534
);
543535

544-
print(`WEIGHTS: ${weights.join(", ")}`);
545-
546536
const note = rollWeighted(
547537
noteSubTypes,
548538
weights,
549539
npc.GetDropRNG(),
550540
NOTE_DROP_CHANCE,
551541
);
552542

553-
Debugger.rng(
554-
"NoteDrop",
555-
`Rolled note for NPC ${npc.Type}_${npc.Variant}: ${
556-
note === undefined ? "None" : NOTE_TYPE_DATA[note].name
557-
}`,
558-
);
559-
560-
if (note === undefined) {
561-
/* empty */
562-
} else {
543+
if (note !== undefined) {
563544
spawnNotePickup(note, npc.Position);
564545
}
565546
}
@@ -634,10 +615,5 @@ export class MikuTaintedCharacter extends Character {
634615
`${NAME} (Tainted)`,
635616
"Add description and birthright description.",
636617
);
637-
638-
/* eid.addCollectible(
639-
CollectibleType.BRIMSTONE,
640-
"↓ {{Tears}} x0.33 Fire rate multiplier#{{Chargeable}} Isaac's tears are replaced by a chargeable blood beam#{{Damage}} It deals 9x Isaac's damage over 0.63 seconds#{{ColorGray}}Tainted Miku:#{{Warning}} Brimstone Notes will now drop",
641-
); */
642618
}
643619
}

0 commit comments

Comments
 (0)