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" ;
89import type { EIDExtended } from "../../compat/EID" ;
910import { Debugger } from "../../util/debug" ;
1011import { 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 ,
0 commit comments