Skip to content

Commit

Permalink
New API for SCP Halloween
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 committed Oct 27, 2023
1 parent cf1f99a commit 3be4a6b
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 4 deletions.
18 changes: 18 additions & 0 deletions Exiled.API/Enums/DamageType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,23 @@ public enum DamageType
/// Damage caused by <see cref="ItemType.GunA7"/>.
/// </summary>
A7,

/// <summary>
/// Damage caused by <see cref="RoleTypeId.Scp3114"/>.
/// </summary>
Scp3114,

/// <summary>
/// <see cref="EffectType.Strangled"/>.
/// </summary>
Strangled,

#pragma warning disable CS1591 // Commentaire XML manquant pour le type ou le membre visible publiquement
#pragma warning disable SA1602 // Enumeration items should be documented
MarshmallowMan,
Silent,
MetalPipe,
#pragma warning restore SA1602 // Enumeration items should be documented
#pragma warning restore CS1591 // Commentaire XML manquant pour le type ou le membre visible publiquement
}
}
21 changes: 21 additions & 0 deletions Exiled.API/Enums/EffectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,26 @@ public enum EffectType
/// Teleports the player to the pocket dimension and drains health until the player escapes or is killed.
/// </summary>
PocketCorroding,

/// <summary>
/// The effect permit player to go trough door like Scp-106.
/// </summary>
Ghostly,

/// <summary>
/// Effect given to player when being strangled by SCP-3114.
/// </summary>
Strangled,
#pragma warning disable CS1591 // Commentaire XML manquant pour le type ou le membre visible publiquement
#pragma warning disable SA1602 // Enumeration items should be documented
OrangeCandy,
Spicy,
SugarCrave,
SugarHigh,
SugarRush,
TraumatizedByEvil,
Metal,
#pragma warning restore SA1602 // Enumeration items should be documented
#pragma warning restore CS1591 // Commentaire XML manquant pour le type ou le membre visible publiquement
}
}
17 changes: 16 additions & 1 deletion Exiled.API/Extensions/DamageTypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace Exiled.API.Extensions
using Enums;

using Features;

using PlayerRoles.PlayableScps.Scp3114;

Check failure on line 15 in Exiled.API/Extensions/DamageTypeExtensions.cs

View workflow job for this annotation

GitHub Actions / push

The type or namespace name 'Scp3114' does not exist in the namespace 'PlayerRoles.PlayableScps' (are you missing an assembly reference?)
using PlayerRoles.PlayableScps.Scp939;
using PlayerStatsSystem;

/// <summary>
Expand Down Expand Up @@ -47,6 +48,7 @@ public static class DamageTypeExtensions
{ DeathTranslations.UsedAs106Bait.Id, DamageType.FemurBreaker },
{ DeathTranslations.MicroHID.Id, DamageType.MicroHid },
{ DeathTranslations.Hypothermia.Id, DamageType.Hypothermia },
{ DeathTranslations.MarshmallowMan.Id, DamageType.MarshmallowMan },
};

private static readonly Dictionary<DeathTranslation, DamageType> TranslationConversionInternal = new()
Expand Down Expand Up @@ -76,6 +78,7 @@ public static class DamageTypeExtensions
{ DeathTranslations.UsedAs106Bait, DamageType.FemurBreaker },
{ DeathTranslations.MicroHID, DamageType.MicroHid },
{ DeathTranslations.Hypothermia, DamageType.Hypothermia },
{ DeathTranslations.MarshmallowMan, DamageType.MarshmallowMan },
};

private static readonly Dictionary<ItemType, DamageType> ItemConversionInternal = new()
Expand Down Expand Up @@ -160,6 +163,10 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase)
{
case CustomReasonDamageHandler:
return DamageType.Custom;
case SilentDamageHandler:
return DamageType.Silent;
case MetalPipeDamageHandler:
return DamageType.MetalPipe;
case WarheadDamageHandler:
return DamageType.Warhead;
case ExplosionDamageHandler:
Expand All @@ -170,6 +177,14 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase)
return DamageType.Recontainment;
case Scp096DamageHandler:
return DamageType.Scp096;
case Scp3114DamageHandler scp3114DamageHandler:
return scp3114DamageHandler.Subtype switch
{
Scp3114DamageHandler.HandlerType.Strangulation => DamageType.Strangled,
Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114,
Scp3114DamageHandler.HandlerType.Slap => DamageType.Scp3114,
_ => DamageType.Unknown,
};
case MicroHidDamageHandler:
return DamageType.MicroHid;
case DisruptorDamageHandler:
Expand Down
21 changes: 19 additions & 2 deletions Exiled.API/Extensions/EffectTypeExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ public static class EffectTypeExtension
EffectType.Traumatized => typeof(Traumatized),
EffectType.AntiScp207 => typeof(AntiScp207),
EffectType.Scanned => typeof(Scanned),
EffectType.Ghostly => typeof(Ghostly),
EffectType.Strangled => typeof(Strangled),
EffectType.OrangeCandy => typeof(OrangeCandy),
EffectType.Spicy => typeof(Spicy),
EffectType.SugarCrave => typeof(SugarCrave),
EffectType.SugarHigh => typeof(SugarHigh),
EffectType.SugarRush => typeof(SugarRush),
EffectType.TraumatizedByEvil => typeof(TraumatizedByEvil),
EffectType.Metal => typeof(Metal),

// This should never happen
_ => throw new InvalidOperationException("Invalid effect enum provided"),
Expand Down Expand Up @@ -115,6 +124,14 @@ public static class EffectTypeExtension
Traumatized => EffectType.Traumatized,
AntiScp207 => EffectType.AntiScp207,
Scanned => EffectType.Scanned,
Ghostly => EffectType.Ghostly,
Strangled => EffectType.Strangled,
OrangeCandy => EffectType.OrangeCandy,
Spicy => EffectType.Spicy,
SugarCrave => EffectType.SugarCrave,
SugarHigh => EffectType.SugarHigh,
SugarRush => EffectType.SugarRush,
TraumatizedByEvil => EffectType.TraumatizedByEvil,

// This should never happen
_ => throw new InvalidOperationException("Invalid effect status base provided"),
Expand All @@ -128,7 +145,7 @@ public static class EffectTypeExtension
/// <seealso cref="IsHealing(EffectType)"/>
public static bool IsHarmful(this EffectType effect) => effect is EffectType.Asphyxiated or EffectType.Bleeding
or EffectType.Corroding or EffectType.Decontaminating or EffectType.Hemorrhage or EffectType.Hypothermia
or EffectType.Poisoned or EffectType.Scp207 or EffectType.SeveredHands;
or EffectType.Poisoned or EffectType.Scp207 or EffectType.SeveredHands or EffectType.Strangled;

/// <summary>
/// Returns whether or not the provided <paramref name="effect"/> heals a player.
Expand Down Expand Up @@ -157,7 +174,7 @@ or EffectType.Disabled or EffectType.Ensnared or EffectType.Exhausted or EffectT
/// <seealso cref="IsHealing(EffectType)"/>
public static bool IsPositive(this EffectType effect) => effect is EffectType.BodyshotReduction or EffectType.DamageReduction
or EffectType.Invigorated or EffectType.Invisible or EffectType.MovementBoost or EffectType.RainbowTaste
or EffectType.Scp207 or EffectType.Scp1853 or EffectType.Vitality or EffectType.AntiScp207;
or EffectType.Scp207 or EffectType.Scp1853 or EffectType.Vitality or EffectType.AntiScp207 or EffectType.Ghostly;

/// <summary>
/// Returns whether or not the provided <paramref name="effect"/> affects the player's movement speed.
Expand Down
10 changes: 9 additions & 1 deletion Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Exiled.API.Features.DamageHandlers
using Enums;

using Extensions;

using PlayerRoles.PlayableScps.Scp3114;

Check failure on line 13 in Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs

View workflow job for this annotation

GitHub Actions / push

The type or namespace name 'Scp3114' does not exist in the namespace 'PlayerRoles.PlayableScps' (are you missing an assembly reference?)
using PlayerStatsSystem;

using BaseHandler = PlayerStatsSystem.DamageHandlerBase;
Expand Down Expand Up @@ -40,6 +40,14 @@ public override DamageType Type
{
case Scp096DamageHandler:
return DamageType.Scp096;
case Scp3114DamageHandler scp3114DamageHandler:
return scp3114DamageHandler.Subtype switch
{
Scp3114DamageHandler.HandlerType.Strangulation => DamageType.Strangled,
Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114,
Scp3114DamageHandler.HandlerType.Slap => DamageType.Scp3114,
_ => DamageType.Unknown,
};
case Scp049DamageHandler scp049DamageHandler:
return scp049DamageHandler.DamageSubType switch
{
Expand Down
2 changes: 2 additions & 0 deletions Exiled.API/Features/Roles/Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Exiled.API.Features.Roles
using Scp096GameRole = PlayerRoles.PlayableScps.Scp096.Scp096Role;
using Scp106GameRole = PlayerRoles.PlayableScps.Scp106.Scp106Role;
using Scp173GameRole = PlayerRoles.PlayableScps.Scp173.Scp173Role;
using Scp3114GameRole = PlayerRoles.PlayableScps.Scp3114.Scp3114Role;

Check failure on line 32 in Exiled.API/Features/Roles/Role.cs

View workflow job for this annotation

GitHub Actions / push

The type or namespace name 'Scp3114' does not exist in the namespace 'PlayerRoles.PlayableScps' (are you missing an assembly reference?)
using Scp939GameRole = PlayerRoles.PlayableScps.Scp939.Scp939Role;
using SpectatorGameRole = PlayerRoles.Spectating.SpectatorRole;

Expand Down Expand Up @@ -223,6 +224,7 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s
Scp106GameRole scp106Role => new Scp106Role(scp106Role),
Scp173GameRole scp173Role => new Scp173Role(scp173Role),
Scp939GameRole scp939Role => new Scp939Role(scp939Role),
Scp3114GameRole scp3114Role => new Scp3114Role(scp3114Role),
OverwatchGameRole overwatchRole => new OverwatchRole(overwatchRole),
SpectatorGameRole spectatorRole => new SpectatorRole(spectatorRole),
HumanGameRole humanRole => new HumanRole(humanRole),
Expand Down
61 changes: 61 additions & 0 deletions Exiled.API/Features/Roles/Scp3114Role.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// -----------------------------------------------------------------------
// <copyright file="Scp3114Role.cs" company="Exiled Team">
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Features.Roles
{
using System.Collections.Generic;
using System.Linq;

using Exiled.API.Features.Hazards;
using Mirror;
using PlayerRoles;
using PlayerRoles.PlayableScps.HumeShield;
using PlayerRoles.PlayableScps.Scp3114;
using PlayerRoles.PlayableScps.Subroutines;
using UnityEngine;

using Scp3114GameRole = PlayerRoles.PlayableScps.Scp3114.Scp3114Role;

Check failure on line 21 in Exiled.API/Features/Roles/Scp3114Role.cs

View workflow job for this annotation

GitHub Actions / push

The type or namespace name 'Scp3114' does not exist in the namespace 'PlayerRoles.PlayableScps' (are you missing an assembly reference?)

/// <summary>
/// Defines a role that represents SCP-173.
/// </summary>
public class Scp3114Role : FpcRole, ISubroutinedScpRole, IHumeShieldRole
{
/// <summary>
/// Initializes a new instance of the <see cref="Scp3114Role"/> class.
/// </summary>
/// <param name="baseRole">the base <see cref="Scp3114GameRole"/>.</param>
internal Scp3114Role(Scp3114GameRole baseRole)
: base(baseRole)
{
Base = baseRole;
SubroutineModule = baseRole.SubroutineModule;
HumeShieldModule = baseRole.HumeShieldModule;
}

/// <inheritdoc/>
public override RoleTypeId Type { get; } = RoleTypeId.Scp3114;

/// <inheritdoc/>
public SubroutineManagerModule SubroutineModule { get; }

/// <inheritdoc/>
public HumeShieldModuleBase HumeShieldModule { get; }

/// <summary>
/// Gets the <see cref="Scp3114GameRole"/> instance.
/// </summary>
public new Scp3114GameRole Base { get; }

/// <summary>
/// Gets the Spawn Chance of SCP-173.
/// </summary>
/// <param name="alreadySpawned">The List of Roles already spawned.</param>
/// <returns>The Spawn Chance.</returns>
public float GetSpawnChance(List<RoleTypeId> alreadySpawned) => 0;
}
}

0 comments on commit 3be4a6b

Please sign in to comment.