Skip to content

Commit a1a5675

Browse files
committed
Miku: add ability to permanently charm angels with the Microphone item
1 parent 8c64ed8 commit a1a5675

3 files changed

Lines changed: 52 additions & 18 deletions

File tree

TODO.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@
1111

1212
## TODO: Miku
1313

14-
- [ ] Balance Stats & charming chances + birthright fan chances.
14+
- [x] Balance Stats & charming chances + birthright fan chances.
1515
- [ ] Add item synergies.
16-
- [ ] Hopefully add Miku Leek synergy with Mom's Knife or Spirit Sword
17-
- [ ] Maybe add charm blacklist, instead of just skipping over all bosses.
18-
- [ ] Maybe add charmable Angels.
16+
- [ ] Maybe add Miku Leek synergy with Mom's Knife and/or Spirit Sword
17+
- [ ] Add charm blacklist, instead of just skipping over all bosses.
18+
- [x] Maybe add charmable Angels.
19+
- [x] Angels can now be charmed with the 'Microphone' active item.
1920

2021
## TODO: Tainted Miku
2122

2223
- [ ] Balance Stats and note drop rates.
2324
- [ ] Add more unique notes and balance them correctly.
24-
- [ ] Add item synergies tied to special and unique note types.
25+
- [x] Add item synergies tied to special and unique note types.
26+
- [x] Add Brimstone Synergy
27+
- [x] Add Dr. Fetus Synergy
2528
- [ ] TODO: Synergy ideas.
29+
- [x] Fix fire rate multiplier issues with several items.
30+
- [x] Fix Monstro's Lung.
2631
- [ ] Add Birthright for Tainted Miku.
2732
- [ ] Add Tainted Miku Icons & Controls.

src/items/MicrophoneItem/MicrophoneItem.ts

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import type {
2-
ActiveSlot,
1+
import type { ActiveSlot, UseFlag } from "isaac-typescript-definitions";
2+
import {
33
CollectibleType,
4-
UseFlag,
4+
EntityType,
5+
ModCallback,
6+
RoomType,
57
} from "isaac-typescript-definitions";
6-
import { ModCallback } from "isaac-typescript-definitions";
7-
import { Callback } from "isaacscript-common";
8+
import { Callback, spawnCollectible } from "isaacscript-common";
89
import type { EIDExtended } from "../../compat/EID";
910
import { Debugger } from "../../util/debug";
1011
import { charmEnemy, getEnemies, isCharmable } from "../../util/enemies";
@@ -31,20 +32,47 @@ export class MicrophoneItem extends ActiveItem {
3132
override onPostUseItem(
3233
_collectibleType: CollectibleType,
3334
_rng: RNG,
34-
_player: EntityPlayer,
35+
player: EntityPlayer,
3536
_flags: BitFlags<UseFlag>,
3637
_slot: ActiveSlot,
3738
_data: int,
3839
): UseItemResult {
39-
const enemies = getEnemies().filter(isCharmable);
40+
const enemies = getEnemies();
41+
42+
const room = Game().GetRoom();
43+
const inAngelRoom = room.GetType() === RoomType.ANGEL;
4044

41-
let count = 0;
4245
for (const enemy of enemies) {
43-
charmEnemy(enemy, 0, true);
44-
count++;
45-
}
46+
if (inAngelRoom) {
47+
if (enemy.Type === EntityType.URIEL) {
48+
if (!player.HasCollectible(CollectibleType.KEY_PIECE_1)) {
49+
spawnCollectible(
50+
CollectibleType.KEY_PIECE_1,
51+
room.FindFreePickupSpawnPosition(enemy.Position),
52+
player.GetDropRNG(),
53+
);
54+
}
55+
charmEnemy(enemy, 0, true, true);
56+
continue;
57+
}
4658

47-
Debugger.item(NAME, `Turned ${count} enemies into fans.`);
59+
if (enemy.Type === EntityType.GABRIEL) {
60+
if (!player.HasCollectible(CollectibleType.KEY_PIECE_2)) {
61+
spawnCollectible(
62+
CollectibleType.KEY_PIECE_2,
63+
room.FindFreePickupSpawnPosition(enemy.Position),
64+
player.GetDropRNG(),
65+
);
66+
}
67+
charmEnemy(enemy, 0, true, true);
68+
continue;
69+
}
70+
}
71+
72+
if (isCharmable(enemy)) {
73+
charmEnemy(enemy, 0, true);
74+
}
75+
}
4876

4977
return {
5078
Discharge: true,

src/util/enemies.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ export const charmEnemy = (
4141
entity: Entity,
4242
seconds: float,
4343
permanent = false,
44+
bosses = false,
4445
): boolean => {
4546
entity.AddCharmed(
4647
EntityRef(entity),
47-
permanent && !entity.IsBoss() ? -1 : getFrames(seconds),
48+
permanent && (bosses || !entity.IsBoss()) ? -1 : getFrames(seconds),
4849
);
4950
return true;
5051
};

0 commit comments

Comments
 (0)