mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* feat: effigy-driven colossus * feat: impl final stage, tweaks, randomization, fixes * fix: actually broadcast first effigy audio * style: add some newlines * feat: notify player about updated target location in chat * tweak: effigy always grows * feat: make alwaysGrow show on anom scanner * tweak: raise minimumPlayers to 35 * refactor: move FTL additions to _DV * refactor: break out buffs into comps, add event also added missing docs and made effigies heal colossi fully, as specified in the PR body. I accidentally left it at 50% damage taken. * docs: add effigy comp docs
64 lines
2.5 KiB
C#
64 lines
2.5 KiB
C#
using Content.Server._DV.CosmicCult.Components;
|
|
using Content.Shared._DV.CosmicCult.Components;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Damage.Systems;
|
|
using Content.Shared.Weapons.Melee;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server._DV.CosmicCult.Abilities.Colossus;
|
|
|
|
public sealed class CosmicColossusBuffsSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly DamageableSystem _damage = default!;
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<MultiplyAttackRateOnSupercriticalComponent, CosmicColossusEffigySupercriticalEvent>(HandleAttackRate);
|
|
SubscribeLocalEvent<FlatAttackBonusOnSupercriticalComponent, CosmicColossusEffigySupercriticalEvent>(HandleDamageBonus);
|
|
SubscribeLocalEvent<MultiplyCorruptingSpeedOnSupercriticalComponent, CosmicColossusEffigySupercriticalEvent>(HandleCorruptingSpeed);
|
|
SubscribeLocalEvent<HealOnSupercriticalComponent, CosmicColossusEffigySupercriticalEvent>(HandleHeal);
|
|
}
|
|
|
|
private void HandleAttackRate(Entity<MultiplyAttackRateOnSupercriticalComponent> ent,
|
|
ref CosmicColossusEffigySupercriticalEvent args)
|
|
{
|
|
if (TryComp<MeleeWeaponComponent>(ent, out var weapon))
|
|
{
|
|
weapon.AttackRate *= ent.Comp.Multiplier;
|
|
}
|
|
}
|
|
|
|
private void HandleDamageBonus(Entity<FlatAttackBonusOnSupercriticalComponent> ent,
|
|
ref CosmicColossusEffigySupercriticalEvent args)
|
|
{
|
|
if (!TryComp<CosmicColossusComponent>(ent, out var colossusComp))
|
|
return;
|
|
|
|
colossusComp.BonusDamage +=
|
|
new DamageSpecifier(_proto.Index(ent.Comp.BonusDamageType), ent.Comp.BonusDamage);
|
|
}
|
|
|
|
private void HandleCorruptingSpeed(Entity<MultiplyCorruptingSpeedOnSupercriticalComponent> ent,
|
|
ref CosmicColossusEffigySupercriticalEvent args)
|
|
{
|
|
if (TryComp<CosmicCorruptingComponent>(ent, out var corrupting))
|
|
{
|
|
corrupting.CorruptionSpeed *= ent.Comp.Multiplier;
|
|
}
|
|
}
|
|
|
|
private void HandleHeal(Entity<HealOnSupercriticalComponent> ent, ref CosmicColossusEffigySupercriticalEvent args)
|
|
{
|
|
if (TryComp<DamageableComponent>(ent, out var damageable))
|
|
{
|
|
_damage.TryChangeDamage(ent.Owner,
|
|
-damageable.Damage * Math.Abs(ent.Comp.DamageFractionHealed), // just in case someone sets a negative value in YML
|
|
true);
|
|
}
|
|
}
|
|
}
|