Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Content.Client/ADT/Chaplain/EUI/AcceptReligionEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Content.Shared.Chaplain;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;

namespace Content.Client.Chaplain;

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/ADT/Chaplain/Systems/ChaplainSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.ADT.Phantom.Components;
using Robust.Client.GameObjects;
using Robust.Client.Player;
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/ADT/Phantom/Systems/PhantomHudSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Content.Client.Overlays;
using Content.Shared.Antag;
using Robust.Client.Player;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;

namespace Content.Client.ADT.Phantom;
public sealed class ShowHauntedIconsSystem : EquipmentHudSystem<ShowHauntedIconsComponent>
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/ADT/Chaplain/EUI/AcceptReligionEui.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Server.EUI;
using Content.Shared.Chaplain;
using Content.Shared.Eui;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Server.Bible;

namespace Content.Server.Chaplain;
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/ADT/Chaplain/Systems/ChaplainSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Server.Popups;
using Content.Shared.ActionBlocker;
using Content.Shared.Actions;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Damage;
using Content.Shared.IdentityManagement;
using Content.Shared.Inventory;
Expand Down
77 changes: 77 additions & 0 deletions Content.Server/ADT/Chaplain/Systems/HolyMelonImmunitySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Hands;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Robust.Shared.GameObjects;

namespace Content.Server.ADT.Chaplain.Systems;

/// <summary>
/// Система отслеживает предметы с <see cref="HolyMelonImmunityComponent"/> в руках игроков
/// и выдаёт им временный компонент <see cref="HolyMelonMagicImmunityComponent"/> для иммунитета к магии.
/// Иммунитет работает только пока предмет находится в руке.
/// </summary>
public sealed class HolyMelonImmunitySystem : EntitySystem
{
[Dependency] private readonly SharedHandsSystem _hands = default!;

public override void Initialize()
{
base.Initialize();

// Подписываемся на события экипировки/снятия арбуза
SubscribeLocalEvent<HolyMelonImmunityComponent, GotEquippedHandEvent>(OnGotEquippedHand);
SubscribeLocalEvent<HolyMelonImmunityComponent, GotUnequippedHandEvent>(OnGotUnequippedHand);
}

private void OnGotEquippedHand(EntityUid uid, HolyMelonImmunityComponent component, GotEquippedHandEvent args)
{
// НЕ добавляем иммунитет священникам — у них он уже есть врождённый
if (HasComp<ChaplainComponent>(args.User))
return;

// Добавляем временный маркер иммунитета от арбуза
EnsureComp<HolyMelonMagicImmunityComponent>(args.User);

// Основной компонент иммунитета (если ещё не добавлен)
EnsureComp<MagicImmunityComponent>(args.User);
}

private void OnGotUnequippedHand(EntityUid uid, HolyMelonImmunityComponent component, GotUnequippedHandEvent args)
{
// НЕ снимаем иммунитет у священников — у них он врождённый
if (HasComp<ChaplainComponent>(args.User))
return;

RemoveImmunityIfNoOtherMelons(args.User, uid);
}

private void RemoveImmunityIfNoOtherMelons(EntityUid holder, EntityUid? excludeItem = null)
{
if (!HasComp<HolyMelonMagicImmunityComponent>(holder))
return;

if (!TryComp<HandsComponent>(holder, out var hands))
return;

foreach (var hand in _hands.EnumerateHeld((holder, hands)))
{
// Исключаем предмет, который снимается
if (excludeItem.HasValue && hand == excludeItem.Value)
continue;

if (HasComp<HolyMelonImmunityComponent>(hand))
return;
}

// Нет других арбузов в руках - удаляем временный маркер
RemComp<HolyMelonMagicImmunityComponent>(holder);

// Удаляем основной компонент иммунитета, только если нет других источников
// (священник имеет ChaplainComponent, который не удаляется)
if (!HasComp<ChaplainComponent>(holder))
{
RemComp<MagicImmunityComponent>(holder);
}
}
}
32 changes: 32 additions & 0 deletions Content.Server/ADT/Chaplain/Systems/MagicProjectileSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Content.Shared.ADT.Chaplain.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics.Events;

namespace Content.Server.ADT.Chaplain.Systems;

/// <summary>
/// Система для магических снарядов. Проверяет иммунитет к магии у цели при попадании.
/// Если цель имеет иммунитет, снаряд поглощается без эффекта.
/// </summary>
public sealed class MagicProjectileSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<MagicProjectileComponent, StartCollideEvent>(OnMagicProjectileStartCollide);
}

private void OnMagicProjectileStartCollide(EntityUid uid, MagicProjectileComponent component, ref StartCollideEvent args)
{
if (!HasComp<MagicImmunityComponent>(args.OtherEntity))
return;

// Цель имеет иммунитет - отменяем столкновение
// Note: StartCollideEvent - readonly struct, не имеет Cancelled
// Просто удаляем снаряд, чтобы он не обрабатывался дальше

// Удаляем снаряд
QueueDel(uid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Content.Server.Popups;
using Content.Shared.Body.Systems;
using Content.Shared.Body.Part;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.DoAfter;
using Content.Shared.Cargo;
using Content.Shared.Database;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Content.Server.Atmos.Components;
using Content.Server.Body.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Atmos.Components;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
Expand Down Expand Up @@ -100,7 +101,8 @@ private void OnNWRebirth(Entity<HereticComponent> ent, ref EventHereticNightwatc
continue;

if ((TryComp<HereticComponent>(look, out var th) && th.CurrentPath == ent.Comp.CurrentPath)
|| HasComp<GhoulComponent>(look))
|| HasComp<GhoulComponent>(look)
|| HasComp<MagicImmunityComponent>(look))
continue;

if (TryComp<FlammableComponent>(look, out var flam))
Expand Down
18 changes: 7 additions & 11 deletions Content.Server/ADT/Heretic/Abilities/HereticAbilitySystem.Void.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Content.Server.Magic;
using Content.Server.Temperature.Components;
using Content.Shared.ADT.Heretic.Components;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Prototypes;
Expand Down Expand Up @@ -77,10 +77,9 @@ private void OnVoidBlink(Entity<HereticComponent> ent, ref HereticVoidBlinkEvent
_aud.PlayPvs(new SoundPathSpecifier("/Audio/Effects/tesla_consume.ogg"), ent);

foreach (var pookie in GetNearbyPeople(ent, power))
if (!HasComp<ChaplainComponent>(pookie))
{
_stun.TryKnockdown(pookie, TimeSpan.FromSeconds(power), true);
}
{
_stun.TryKnockdown(pookie, TimeSpan.FromSeconds(power), true);
}

_transform.SetCoordinates(ent, args.Target);

Expand All @@ -89,11 +88,8 @@ private void OnVoidBlink(Entity<HereticComponent> ent, ref HereticVoidBlinkEvent

foreach (var pookie in GetNearbyPeople(ent, ent.Comp.PathStage / 3f))
{
if (!HasComp<ChaplainComponent>(pookie))
{
_stam.TakeStaminaDamage(pookie, power);
if (condition) _voidcurse.DoCurse(pookie);
}
_stam.TakeStaminaDamage(pookie, power);
if (condition) _voidcurse.DoCurse(pookie);
}

args.Handled = true;
Expand All @@ -113,7 +109,7 @@ private void OnVoidPull(Entity<HereticComponent> ent, ref HereticVoidPullEvent a
// damage closest ones
foreach (var pookie in topPriority)
{
if (!TryComp<DamageableComponent>(pookie, out var dmgComp) || HasComp<ChaplainComponent>(pookie))
if (!TryComp<DamageableComponent>(pookie, out var dmgComp))
continue;

// total damage + power divided by all damage types.
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/ADT/Heretic/Abilities/HereticAbilitySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Content.Server.Station.Systems;
using Content.Server.Store.Systems;
using Content.Server.Temperature.Systems;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Actions;
using Content.Shared.Body.Systems;
using Content.Shared.Chat;
Expand Down Expand Up @@ -88,7 +89,8 @@ private List<EntityUid> GetNearbyPeople(Entity<HereticComponent> ent, float rang
{
// ignore heretics with the same path*, affect everyone else
if ((TryComp<HereticComponent>(look, out var th) && th.CurrentPath == ent.Comp.CurrentPath)
|| HasComp<GhoulComponent>(look))
|| HasComp<GhoulComponent>(look)
|| HasComp<MagicImmunityComponent>(look))
continue;

if (!HasComp<StatusEffectsComponent>(look))
Expand Down
10 changes: 5 additions & 5 deletions Content.Server/ADT/Heretic/EntitySystems/MansusGraspSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems;
using Content.Shared.ADT.Heretic.Components;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Actions;
using Content.Shared.Damage;
using Content.Shared.Damage.Systems;
Expand Down Expand Up @@ -88,7 +88,7 @@ private void OnAfterInteract(Entity<MansusGraspComponent> ent, ref AfterInteract
if ((TryComp<HereticComponent>(args.Target, out var th) && th.CurrentPath == ent.Comp.Path))
return;

if (HasComp<StatusEffectsComponent>(target) && !HasComp<ChaplainComponent>(target))
if (HasComp<StatusEffectsComponent>(target) && !HasComp<MagicImmunityComponent>(target))
{
_chat.TrySendInGameICMessage(args.User, Loc.GetString("heretic-speech-mansusgrasp"), InGameICChatType.Speak, false);
_audio.PlayPvs(new SoundPathSpecifier("/Audio/Items/welder.ogg"), target);
Expand All @@ -101,10 +101,10 @@ private void OnAfterInteract(Entity<MansusGraspComponent> ent, ref AfterInteract
// upgraded grasp
if (hereticComp.CurrentPath != null)
{
if (hereticComp.PathStage >= 2 && !HasComp<ChaplainComponent>(target))
if (hereticComp.PathStage >= 2 && !HasComp<MagicImmunityComponent>(target))
ApplyGraspEffect(args.User, target, hereticComp.CurrentPath!);

if (hereticComp.PathStage >= 4 && HasComp<StatusEffectsComponent>(target) && !HasComp<ChaplainComponent>(target))
if (hereticComp.PathStage >= 4 && HasComp<StatusEffectsComponent>(target) && !HasComp<MagicImmunityComponent>(target))
{
var markComp = EnsureComp<HereticCombatMarkComponent>(target);
markComp.Path = hereticComp.CurrentPath;
Expand Down Expand Up @@ -263,7 +263,7 @@ private void OnInfusedInteract(Entity<MansusInfusedComponent> ent, ref InteractH

if (HasComp<StatusEffectsComponent>(target))
{
if (!HasComp<ChaplainComponent>(target))
if (!HasComp<MagicImmunityComponent>(target))
{
_audio.PlayPvs(new SoundPathSpecifier("/Audio/Items/welder.ogg"), target);
_stun.TryKnockdown(target, TimeSpan.FromSeconds(3f), true);
Expand Down
10 changes: 9 additions & 1 deletion Content.Server/ADT/Magic/ChainFireballSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Popups;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Projectiles;
using Content.Shared.StatusEffect;
using Content.Shared.Weapons.Ranged.Systems;
Expand Down Expand Up @@ -30,6 +31,12 @@ private void OnHit(Entity<ChainFireballComponent> ent, ref ProjectileHitEvent ar
if (_random.Prob(ent.Comp.DisappearChance))
return;

if (HasComp<MagicImmunityComponent>(args.Target))
{
QueueDel(ent);
return;
}

// spawn new fireball on target
Spawn(args.Target, ent.Comp.IgnoredTargets);

Expand All @@ -44,7 +51,8 @@ public bool Spawn(EntityUid source, List<EntityUid> ignoredTargets)
foreach (var look in lookup)
{
if (ignoredTargets.Contains(look)
|| !HasComp<StatusEffectsComponent>(look)) // ignore non mobs
|| !HasComp<StatusEffectsComponent>(look) // ignore non mobs
|| HasComp<MagicImmunityComponent>(look)) // иммун к магии
continue;

mobs.Add(look);
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/ADT/Magic/ImmovableVoidRodSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Server.Heretic.Components;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Heretic;
using Content.Shared.Maps;
using Content.Shared.Stunnable;
Expand Down Expand Up @@ -54,7 +54,8 @@ public override void Initialize()
private void OnCollide(Entity<ImmovableVoidRodComponent> ent, ref StartCollideEvent args)
{
if ((TryComp<HereticComponent>(args.OtherEntity, out var th) && th.CurrentPath == "Void")
|| HasComp<GhoulComponent>(args.OtherEntity) || HasComp<ChaplainComponent>(args.OtherEntity))
|| HasComp<GhoulComponent>(args.OtherEntity)
|| HasComp<MagicImmunityComponent>(args.OtherEntity))
return;

var power = 1f;
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/ADT/Phantom/EntitySystems/PhantomSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using Content.Shared.ADT.Phantom.Components;
using Content.Shared.ADT.Silicon.Components;
using Content.Shared.Alert;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Chat;
using Content.Shared.CombatMode;
using Content.Shared.Cuffs.Components;
Expand Down Expand Up @@ -2635,4 +2635,4 @@ public void Blessing(EntityUid uid, PhantomComponent component)
}
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Content.Shared.ADT.GhostInteractions;
using Content.Shared.ADT.Poltergeist;
using Content.Shared.ADT.Silicon.Components;
using Content.Shared.Bible.Components;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Chat;
using Content.Shared.IdentityManagement;
using Content.Shared.Item;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Content.Server.EUI;
using Content.Shared.Revolutionary;
using Content.Shared.Eui;
using Content.Shared.Bible.Components;
using Content.Server.Bible;
using Content.Shared.Revolutionary.Components;
using Content.Server.GameTicking.Rules;
Expand Down
3 changes: 1 addition & 2 deletions Content.Server/Bible/BibleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
using Content.Server.Popups;
using Content.Shared.ActionBlocker;
using Content.Shared.Actions;
using Content.Shared.Bible;
using Content.Shared.ADT.Chaplain.Components;
using Content.Shared.Damage.Systems;
using Content.Shared.Bible.Components;
using Content.Shared.Damage;
using Content.Shared.Ghost.Roles.Components;
using Content.Shared.IdentityManagement;
Expand Down
Loading
Loading