From 3bad02beec61fcac2e39916fab1fd1f1c265df44 Mon Sep 17 00:00:00 2001 From: Vigers Ray Date: Sat, 4 Jan 2025 02:12:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=B5=D1=81=20=D1=86=D0=B5?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=B2=D0=B0=D0=BC=D0=BF=D0=B8=D1=80=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BA=D0=BE=D0=B4=D0=B0=20=D0=B2=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D1=82=D0=B8=D0=BF=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Rules/Components/VampireRuleComponent.cs | 27 +------------ .../GameTicking/Rules/VampireRuleSystem.cs | 39 ++++++------------- Resources/Prototypes/GameRules/midround.yml | 4 ++ Resources/Prototypes/Objectives/vampire.yml | 39 +++++++++++-------- .../_Sunrise/Objectives/objectiveGroups.yml | 30 ++++++++++++++ 5 files changed, 68 insertions(+), 71 deletions(-) create mode 100644 Resources/Prototypes/_Sunrise/Objectives/objectiveGroups.yml diff --git a/Content.Server/GameTicking/Rules/Components/VampireRuleComponent.cs b/Content.Server/GameTicking/Rules/Components/VampireRuleComponent.cs index 3fc2b7c2d06..2dc679a9cd4 100644 --- a/Content.Server/GameTicking/Rules/Components/VampireRuleComponent.cs +++ b/Content.Server/GameTicking/Rules/Components/VampireRuleComponent.cs @@ -10,29 +10,4 @@ namespace Content.Server.GameTicking.Rules.Components; public sealed partial class VampireRuleComponent : Component { public readonly List VampireMinds = new(); - - - public readonly List> BaseObjectives = new() - { - "VampireKillRandomPersonObjective", - "VampireDrainObjective" - }; - - public readonly List> EscapeObjectives = new() - { - "VampireSurviveObjective", - "VampireEscapeObjective" - }; - - public readonly List> StealObjectives = new() - { - "CMOHyposprayVampireStealObjective", - "RDHardsuitVampireStealObjective", - "EnergyShotgunVampireStealObjective", - "MagbootsVampireStealObjective", - "ClipboardVampireStealObjective", - "CaptainIDVampireStealObjective", - "CaptainJetpackVampireStealObjective", - "CaptainGunVampireStealObjective" - }; -} \ No newline at end of file +} diff --git a/Content.Server/GameTicking/Rules/VampireRuleSystem.cs b/Content.Server/GameTicking/Rules/VampireRuleSystem.cs index 23dba7c49a9..21a1a4de00a 100644 --- a/Content.Server/GameTicking/Rules/VampireRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/VampireRuleSystem.cs @@ -5,7 +5,7 @@ using Content.Server.Objectives; using Content.Server.Roles; using Content.Server.Vampire; -using Content.Server.Bible.Components; +using Content.Server.Bible.Components; using Content.Shared.Alert; using Content.Shared.Vampire.Components; using Content.Shared.NPC.Prototypes; @@ -56,7 +56,7 @@ public override void Initialize() private void OnSelectAntag(EntityUid mindId, VampireRuleComponent comp, ref AfterAntagEntitySelectedEvent args) { var ent = args.EntityUid; - + if (HasComp(ent)) return; @@ -91,12 +91,12 @@ public bool MakeVampire(EntityUid target, VampireRuleComponent rule) EnsureComp(target); var vampireAlertComponent = EnsureComp(target); var interfaceComponent = EnsureComp(target); - + if (HasComp(target)) _uiSystem.SetUiState(target, VampireMutationUiKey.Key, new VampireMutationBoundUserInterfaceState(vampireComponent.VampireMutations, vampireComponent.CurrentMutation)); - + var vampire = new Entity(target, vampireComponent); - + RemComp(vampire); RemComp(vampire); RemComp(vampire); @@ -104,50 +104,33 @@ public bool MakeVampire(EntityUid target, VampireRuleComponent rule) vampireComponent.Balance = new() { { VampireComponent.CurrencyProto, 0 } }; rule.VampireMinds.Add(mindId); - + _vampire.AddStartingAbilities(vampire); _vampire.MakeVulnerableToHoly(vampire); _alerts.ShowAlert(vampire, vampireAlertComponent.BloodAlert); _alerts.ShowAlert(vampire, vampireAlertComponent.StellarWeaknessAlert); - - Random random = new Random(); - - foreach (var objective in rule.BaseObjectives) - _mind.TryAddObjective(mindId, mind, objective); - - if (rule.EscapeObjectives.Count > 0) - { - var randomEscapeObjective = rule.EscapeObjectives[random.Next(rule.EscapeObjectives.Count)]; - _mind.TryAddObjective(mindId, mind, randomEscapeObjective); - } - - if (rule.StealObjectives.Count > 0) - { - var randomEscapeObjective = rule.StealObjectives[random.Next(rule.StealObjectives.Count)]; - _mind.TryAddObjective(mindId, mind, randomEscapeObjective); - } return true; } - + private void OnGetBriefing(Entity role, ref GetBriefingEvent args) { var ent = args.Mind.Comp.OwnedEntity; - + if (ent is null) return; args.Append(MakeBriefing(ent.Value)); } - + private string MakeBriefing(EntityUid ent) { if (TryComp(ent, out var metaData)) { var briefing = Loc.GetString("vampire-role-greeting", ("name", metaData?.EntityName ?? "Unknown")); - + return briefing; } - + return ""; } diff --git a/Resources/Prototypes/GameRules/midround.yml b/Resources/Prototypes/GameRules/midround.yml index a846270fa47..192425d3c5e 100644 --- a/Resources/Prototypes/GameRules/midround.yml +++ b/Resources/Prototypes/GameRules/midround.yml @@ -55,6 +55,10 @@ - type: GameRule minPlayers: 5 - type: VampireRule + - type: AntagRandomObjectives + sets: + - groups: VampireObjectiveGroups + maxDifficulty: 10 - type: AntagSelection agentName: vampire-roundend-name definitions: diff --git a/Resources/Prototypes/Objectives/vampire.yml b/Resources/Prototypes/Objectives/vampire.yml index c116554b66f..86db150b91f 100644 --- a/Resources/Prototypes/Objectives/vampire.yml +++ b/Resources/Prototypes/Objectives/vampire.yml @@ -12,7 +12,7 @@ roles: mindRoles: - VampireRole - + - type: entity abstract: true parent: [BaseVampireObjective, BaseStealObjective] @@ -24,7 +24,7 @@ difficulty: 1.5 - type: ObjectiveLimit limit: 2 - + # Steal - type: entity @@ -115,17 +115,6 @@ # States -- type: entity - parent: [BaseVampireObjective, BaseSurviveObjective] - id: VampireSurviveObjective - name: Survive - description: I must survive no matter what. - components: - - type: Objective - icon: - sprite: Interface/Actions/actions_vampire.rsi - state: survive_icon - - type: entity parent: [BaseVampireObjective, BaseLivingObjective] id: VampireEscapeObjective @@ -138,9 +127,9 @@ sprite: Structures/Furniture/chairs.rsi state: shuttle - type: EscapeShuttleCondition - + # Kill - + - type: entity parent: [BaseVampireObjective, BaseKillObjective] id: VampireKillRandomPersonObjective @@ -152,7 +141,23 @@ - type: TargetObjective title: objective-condition-kill-person-title - type: PickRandomPerson - + - type: KillPersonCondition + requireDead: true + +- type: entity + parent: [BaseVampireObjective, BaseKillObjective] + id: VampireKillRandomAntagObjective + description: + components: + - type: Objective + difficulty: 3.0 + unique: true + - type: TargetObjective + title: objective-condition-kill-antag-title + - type: PickRandomAntag + - type: KillPersonCondition + requireDead: true + # Drain - type: entity @@ -168,4 +173,4 @@ max: 600 title: objective-condition-drain-title description: objective-condition-drain-description - - type: BloodDrainCondition \ No newline at end of file + - type: BloodDrainCondition diff --git a/Resources/Prototypes/_Sunrise/Objectives/objectiveGroups.yml b/Resources/Prototypes/_Sunrise/Objectives/objectiveGroups.yml new file mode 100644 index 00000000000..0dd24447744 --- /dev/null +++ b/Resources/Prototypes/_Sunrise/Objectives/objectiveGroups.yml @@ -0,0 +1,30 @@ +- type: weightedRandom + id: VampireObjectiveGroups + weights: + VampireObjectiveGroupSteal: 1 + VampireObjectiveGroupKill: 1 + VampireObjectiveGroupState: 1 + +- type: weightedRandom + id: VampireObjectiveGroupSteal + weights: + CMOHyposprayVampireStealObjective: 1 + RDHardsuitVampireStealObjective: 1 + EnergyShotgunVampireStealObjective: 1 + MagbootsVampireStealObjective: 1 + ClipboardVampireStealObjective: 1 + CaptainIDVampireStealObjective: 1 + CaptainJetpackVampireStealObjective: 1 + CaptainGunVampireStealObjective: 1 + +- type: weightedRandom + id: VampireObjectiveGroupKill + weights: + VampireKillRandomAntagObjective: 1 + VampireKillRandomPersonObjective: 0.5 + +- type: weightedRandom + id: VampireObjectiveGroupState + weights: + VampireDrainObjective: 1 + VampireEscapeObjective: 1