1+ using System . ComponentModel ;
12using Exiled . API . Enums ;
23using Exiled . API . Features ;
34using Exiled . API . Features . Attributes ;
67using Exiled . Events . EventArgs . Player ;
78using ExtendedItems . Types ;
89using MEC ;
9- using System . ComponentModel ;
1010using PlayerStatsSystem ;
11- using PlayerEvents = Exiled . Events . Handlers . Player ;
1211using UnityEngine ;
12+ using PlayerEvents = Exiled . Events . Handlers . Player ;
1313
1414namespace ExtendedItems . Items
1515{
@@ -26,35 +26,37 @@ public class Coin : CustomItem
2626 Limit = 3 ,
2727 RoomSpawnPoints =
2828 [
29- new RoomSpawnPoint ( ) { Room = RoomType . LczCafe , Chance = 50 } ,
30- new RoomSpawnPoint ( ) { Room = RoomType . LczToilets , Chance = 50 } ,
31- new RoomSpawnPoint ( ) { Room = RoomType . HczArmory , Chance = 50 } ,
29+ new RoomSpawnPoint { Room = RoomType . LczCafe , Chance = 50 , } ,
30+ new RoomSpawnPoint { Room = RoomType . LczToilets , Chance = 50 , } ,
31+ new RoomSpawnPoint { Room = RoomType . HczArmory , Chance = 50 , } ,
3232 ] ,
3333 DynamicSpawnPoints =
3434 [
35- new DynamicSpawnPoint ( ) { Location = SpawnLocationType . InsideEscapePrimary , Chance = 50 } ,
36- ]
35+ new DynamicSpawnPoint { Location = SpawnLocationType . InsideEscapePrimary , Chance = 50 , } ,
36+ ] ,
3737 } ;
3838
3939 [ Description ( "Effects to give if coin landed on heads." ) ]
40- private static CoinEffect [ ] Effects =>
40+ private static CoinEffect [ ] Effects =>
4141 [
42- new ( ) { Type = EffectType . DamageReduction , Duration = 15 , Intensity = 75 } ,
43- new ( ) { Type = EffectType . RainbowTaste , Duration = 15 , Intensity = byte . MaxValue } ,
44- new ( ) { Type = EffectType . Invigorated , Duration = 15 , Intensity = byte . MaxValue } ,
45- new ( ) { Type = EffectType . MovementBoost , Duration = 15 , Intensity = 75 } ,
42+ new ( ) { Type = EffectType . DamageReduction , Duration = 15 , Intensity = 75 , } ,
43+ new ( ) { Type = EffectType . RainbowTaste , Duration = 15 , Intensity = byte . MaxValue , } ,
44+ new ( ) { Type = EffectType . Invigorated , Duration = 15 , Intensity = byte . MaxValue , } ,
45+ new ( ) { Type = EffectType . MovementBoost , Duration = 15 , Intensity = 75 , } ,
4646 ] ;
4747
4848 protected override void SubscribeEvents ( )
4949 {
5050 PlayerEvents . FlippingCoin += OnFlippingCoin ;
51+ PlayerEvents . ChangingRole += OnRoleChanging ;
5152
5253 base . SubscribeEvents ( ) ;
5354 }
5455
5556 protected override void UnsubscribeEvents ( )
5657 {
5758 PlayerEvents . FlippingCoin -= OnFlippingCoin ;
59+ PlayerEvents . ChangingRole -= OnRoleChanging ;
5860
5961 base . UnsubscribeEvents ( ) ;
6062 }
@@ -68,27 +70,32 @@ private void OnFlippingCoin(FlippingCoinEventArgs ev)
6870 if ( ev . IsTails && ! ev . Player . IsDead )
6971 {
7072 ev . Player . Scale = Vector3 . zero ;
71- string cause = Plugin . Instance ? . Config . LoseCauses . RandomItem ( ) ?? "<Error: Coin Reason Not Found>" ;
72- Ragdoll ? ragdoll = Ragdoll . CreateAndSpawn ( ev . Player . Role . Type , ev . Player . DisplayNickname ,
73+ var cause = Plugin . Instance ? . Config . LoseCauses . RandomItem ( ) ?? "<Error: Coin Reason Not Found>" ;
74+ var ragdoll = Ragdoll . CreateAndSpawn ( ev . Player . Role . Type , ev . Player . DisplayNickname ,
7375 new CustomReasonDamageHandler ( $ "{ cause } ") ,
7476 ev . Player . Position , ev . Player . Rotation , ev . Player ) ;
7577
7678 ev . Player . IsGodModeEnabled = false ;
7779
78- ev . Player . Explode ( ) ;
80+ ev . Player . ExplodeEffect ( ProjectileType . FragGrenade ) ;
7981 ev . Player . Kill ( $ "{ cause } ") ;
8082 ev . Player . Scale = Vector3 . one ;
8183 return ;
8284 }
8385
8486 ev . Player . ShowHint ( $ "{ Plugin . Instance ? . Config . WinHints . RandomItem ( ) } ") ;
8587
86- Effects . ForEach ( ( effect ) =>
88+ Effects . ForEach ( effect =>
8789 {
8890 ev . Player . EnableEffect ( effect . Type , effect . Intensity , effect . Duration , true ) ;
8991 } ) ;
9092 } ) ;
9193 }
9294
95+ private void OnRoleChanging ( ChangingRoleEventArgs ev )
96+ {
97+ ev . Player . Scale = Vector3 . one ;
98+ ev . Player . DisableAllEffects ( ) ;
99+ }
93100 }
94101}
0 commit comments