Skip to content

Commit

Permalink
tested, should work well now, time for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikihero committed Sep 16, 2022
1 parent 2ddec57 commit a6110b0
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 83 deletions.
39 changes: 0 additions & 39 deletions BetterCoinflips.cs

This file was deleted.

12 changes: 7 additions & 5 deletions Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class Config : IConfig
[Description("Whether or not the default coins should spawn (eg. in lockers). Default: false")]
public bool SpawnDefaultCoins { get; set; } = false;

[Description("The duration of the broadcast informing you about your 'reward'. Default: 5")]
public ushort BroadcastTime { get; set; } = 5;
[Description("The duration of the broadcast informing you about your 'reward'. Default: 3")]
public ushort BroadcastTime { get; set; } = 3;

[Description("The duration of the map blackout. Default: 10")]
public float MapBlackoutTime { get; set; } = 10;
Expand Down Expand Up @@ -54,19 +54,21 @@ public class Config : IConfig

[Description("The % chance of receiving a Facility Manager keycard instead of a Containment Engineer keycard when that effect is chosen. Default: 15")]
public int RedCardChance { get; set; } = 15;

[Description("The % chance for each of the below good effects to happen, they are checked separately and thus don't have to add up to 100%. If none of those are chosen then the last effect happens.")]
public int KeycardEffectChance { get; set; } = 20;
public int MedicalKitEffectChance { get; set; } = 35;
public int EscapeEffectChance { get; set; } = 5;
public int TPToEscapeEffectChance { get; set; } = 5;
public int HealEffectChance { get; set; } = 10;
public int MoreHPEffectChance { get; set; } = 10;
public int HatEffectChance { get; set; } = 10;
public int RandomGoodEffectChance { get; set; } = 30;
public int OneAmmoLogicerEffectChance { get; set; } = 5;
public int LightbulbEffectChance { get; set; } = 15;
public int OneAmmoLogicerEffectChance { get; set; } = 10;

[Description("The % chance for each of the below bad effects to happen, they are checked separately and thus don't have to add up to 100%. If none of those are chosen then the last effect happens.")]
public int HpReductionEffectChance { get; set; } = 20;
public int TPToClassDCellsEffectChance { get; set; } = 10;
public int TPToClassDCellsEffectChance { get; set; } = 5;
public int RandomBadEffectChance { get; set; } = 30;
public int WarheadEffectChance { get; set; } = 25;
public int LightsOutEffectChance { get; set; } = 15;
Expand Down
52 changes: 26 additions & 26 deletions EventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ public void OnCoinFlip(FlippingCoinEventArgs ev)
int TailsEvent = 0;
if (!ev.IsTails)
{
if (KeycardEffectChance < rd.Next(1, 100)) HeadsEvent = 1;
else if (MedicalKitEffectChance < rd.Next(1, 100)) HeadsEvent = 2;
else if (EscapeEffectChance < rd.Next(1, 100)) HeadsEvent = 3;
else if (HealEffectChance < rd.Next(1, 100)) HeadsEvent = 4;
else if (MoreHPEffectChance < rd.Next(1, 100)) HeadsEvent = 5;
else if (HatEffectChance < rd.Next(1, 100)) HeadsEvent = 6;
else if (RandomGoodEffectChance < rd.Next(1, 100)) HeadsEvent = 7;
else if (LightbulbEffectChance < rd.Next(1, 100)) HeadsEvent = 8;
else if (OneAmmoLogicerEffectChance < rd.Next(1, 100)) HeadsEvent = 9; // doesn't have to exist for now, it is here if I want to expand the effects
if (KeycardEffectChance > rd.Next(1, 100)) HeadsEvent = 1;
else if (MedicalKitEffectChance > rd.Next(1, 100)) HeadsEvent = 2;
else if (TPToEscapeEffectChance > rd.Next(1, 100)) HeadsEvent = 3;
else if (HealEffectChance > rd.Next(1, 100)) HeadsEvent = 4;
else if (MoreHPEffectChance > rd.Next(1, 100)) HeadsEvent = 5;
else if (HatEffectChance > rd.Next(1, 100)) HeadsEvent = 6;
else if (RandomGoodEffectChance > rd.Next(1, 100)) HeadsEvent = 7;
else if (OneAmmoLogicerEffectChance > rd.Next(1, 100)) HeadsEvent = 8;
else if (LightbulbEffectChance > rd.Next(1, 100)) HeadsEvent = 9; // doesn't have to exist for now, it is here if I want to expand the effects

switch (HeadsEvent)
{
case 1:
if(RedCardChance < rd.Next(1, 101))
if(RedCardChance > rd.Next(1, 101))
{
Item.Create(ItemType.KeycardContainmentEngineer).Spawn(ev.Player.Position);
SendBroadcast(ev.Player, "You acquired a Containment Engineer keycard!");
Expand Down Expand Up @@ -78,17 +78,17 @@ public void OnCoinFlip(FlippingCoinEventArgs ev)
SendBroadcast(ev.Player, "You got a random effect.");
break;
case 8:
Item.Create(ItemType.SCP2176).Spawn(ev.Player.Position);
SendBroadcast(ev.Player, "You got a shiny lightbulb!");
break;
default:
case 9:
Item gun = Item.Create(ItemType.GunLogicer);
Firearm f = gun as Firearm;
f.Ammo = 1;
f.Spawn(ev.Player.Position);
SendBroadcast(ev.Player, "You got gun.");
break;
case 9:
default:
Item.Create(ItemType.SCP2176).Spawn(ev.Player.Position);
SendBroadcast(ev.Player, "You got a shiny lightbulb!");
break;
/*case 9:
Scp330 candy = (Scp330)Item.Create(ItemType.SCP330);
candy.AddCandy(InventorySystem.Items.Usables.Scp330.CandyKindID.Pink);
Expand All @@ -99,17 +99,17 @@ public void OnCoinFlip(FlippingCoinEventArgs ev)
}
if (ev.IsTails)
{
if (HpReductionEffectChance < rd.Next(1, 100)) HeadsEvent = 1;
else if (TPToClassDCellsEffectChance < rd.Next(1, 100)) HeadsEvent = 2;
else if (RandomBadEffectChance < rd.Next(1, 100)) HeadsEvent = 3;
else if (WarheadEffectChance < rd.Next(1, 100)) HeadsEvent = 4;
else if (LightsOutEffectChance < rd.Next(1, 100)) HeadsEvent = 5;
else if (LiveHEEffectChance < rd.Next(1, 100)) HeadsEvent = 6;
else if (TrollGunEffectChance < rd.Next(1, 100)) HeadsEvent = 7;
else if (LiveFlasEffectChance < rd.Next(1, 100)) HeadsEvent = 8;
else if (SCPTpEffectChance < rd.Next(1, 100)) HeadsEvent = 9;
else if (OneHPLeftEffectChance < rd.Next(1, 100)) HeadsEvent = 10;
else if (FakeCassieEffectChance < rd.Next(1, 100)) HeadsEvent = 11; // doesn't have to exist for now, it is here if I want to expand the effects
if (HpReductionEffectChance > rd.Next(1, 100)) TailsEvent = 1;
else if (TPToClassDCellsEffectChance > rd.Next(1, 100)) TailsEvent = 2;
else if (RandomBadEffectChance > rd.Next(1, 100)) TailsEvent = 3;
else if (WarheadEffectChance > rd.Next(1, 100)) TailsEvent = 4;
else if (LightsOutEffectChance > rd.Next(1, 100)) TailsEvent = 5;
else if (LiveHEEffectChance > rd.Next(1, 100)) TailsEvent = 6;
else if (TrollGunEffectChance > rd.Next(1, 100)) TailsEvent = 7;
else if (LiveFlasEffectChance > rd.Next(1, 100)) TailsEvent = 8;
else if (SCPTpEffectChance > rd.Next(1, 100)) TailsEvent = 9;
else if (OneHPLeftEffectChance > rd.Next(1, 100)) TailsEvent = 10;
else if (FakeCassieEffectChance > rd.Next(1, 100)) TailsEvent = 11; // doesn't have to exist for now, it is here if I want to expand the effects

switch (TailsEvent)
{
Expand Down
4 changes: 2 additions & 2 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public class Plugin : Plugin<Config>
{
public static Plugin Instance;
public override Version RequiredExiledVersion => new Version(5, 3, 0);
public override Version Version => new Version(1, 0, 0);
public override Version Version => new Version(1, 1, 0);
public override string Author => "Miki_hero";
private EventHandlers EventHandler;

public override void OnEnabled()
{
Instance = this;
try { RegisterEvents(); }
catch(Exception ex) { Log.Error($"Failed to load \"BetterCoinflips\": {ex}");}
catch (Exception ex) { Log.Error($"Failed to load \"BetterCoinflips\": {ex}"); }
base.OnEnabled();
}

Expand Down
49 changes: 38 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ SCP:SL plugin that adds a Risk-Reward mechanic to the in-game coin. Whenever you
5. Their current hp will be increased by 10%.
6. An SCP-268 will spawn at their feet.
7. They will receive a random good effect (configurable) for 5 seconds.
8. An SCP-2176 will spawn at their feet.
8. They will get a Logicer with 1 ammo.
9. An SCP-2176 will spawn at their feet.

- Whenever someone flips a coin and it lands on tails one of the following will happen:
1. Their current hp will be set to 70%.
2. They will be teleported to Class D containment cells.
3. They will get a random bad effect (configurable) for 5 seconds.
4. Warhead will be enabled or disabled depending on it's current state.
5. Lights all across the map will be turned off for 10 seconds.
6. They will get a Logicer with 1 ammo
7. A live grenade will be spawned on their head and explode ~3 seconds later.
8. An empty Particle Disruptor will be spawned at their feet and instantly disappear.
9. A flash grenade will spawn on their head and explode after 1 second.
10. They are teleported to an SCP if there are any alive, otherwise they lose 15 hp.
11. They lose all but 1 hp.
12. A fake CASSIE is send saying that SCP-173 was killed by a Tesla gate.
6. A live grenade will be spawned on their head and explode ~3 seconds later.
7. An empty Particle Disruptor will be spawned at their feet and instantly disappear.
8. A flash grenade will spawn on their head and explode after 1 second.
9. They are teleported to an SCP if there are any alive, otherwise they lose 15 hp.
10. They lose all but 1 hp.
11. A fake CASSIE is send saying that SCP-173 was killed by a Tesla gate.

- If the config option for it is set to true, the plugin will prevent the spawns of any coins in lockers etc.
- The plugin will replace every default SCP-1853 with a coin in the SCP pedestals.

### Default config

Expand All @@ -37,8 +40,8 @@ better_coinflips:
is_enabled: true
# Whether or not the default coins should spawn (eg. in lockers). Default: false
spawn_default_coins: false
# The duration of the broadcast informing you about your 'reward'. Default: 5
broadcast_time: 5
# The duration of the broadcast informing you about your 'reward'. Default: 3
broadcast_time: 3
# The duration of the map blackout. Default: 10
map_blackout_time: 10
# List of bad effects that can be applied to the players. List available at: https://exiled-team.github.io/EXILED/api/Exiled.API.Enums.EffectType.html
Expand Down Expand Up @@ -70,4 +73,28 @@ better_coinflips:
- Vitality
# The % chance of receiving a Facility Manager keycard instead of a Containment Engineer keycard when that effect is chosen. Default: 15
red_card_chance: 15
```
# The % chance for each of the below good effects to happen, they are checked separately and thus don't have to add up to 100%. If none of those are chosen then the last effect happens.
keycard_effect_chance: 20
medical_kit_effect_chance: 35
escape_effect_chance: 5
heal_effect_chance: 10
more_h_p_effect_chance: 10
hat_effect_chance: 10
random_good_effect_chance: 30
one_ammo_logicer_effect_chance: 5
lightbulb_effect_chance: 15
# The % chance for each of the below bad effects to happen, they are checked separately and thus don't have to add up to 100%. If none of those are chosen then the last effect happens.
hp_reduction_effect_chance: 20
t_p_to_class_d_cells_effect_chance: 10
random_bad_effect_chance: 30
warhead_effect_chance: 25
lights_out_effect_chance: 15
live_h_e_effect_chance: 50
troll_gun_effect_chance: 50
live_flas_effect_chance: 50
s_c_p_tp_effect_chance: 35
one_h_p_left_effect_chance: 20
fake_cassie_effect_chance: 45
```
**THESE PERCENTAGES ARE NOT AT ALL BALANCED, THEY'RE JUST SOMETHING I PUT IN PLACE FOR NOW, IF YOU FEEL LIKE EVERYONE WOULD BENEFIT FROM CHANGING ONE OF THE DEFAULT VALUES FEEL FREE TO OPEN A PR/ISSUE ON GITHUB.**

0 comments on commit a6110b0

Please sign in to comment.