Skip to content

Commit

Permalink
vampire objectives
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 committed Oct 31, 2024
1 parent c69424c commit 7292014
Show file tree
Hide file tree
Showing 12 changed files with 257 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ public sealed partial class VampireRuleComponent : Component
{
public readonly List<EntityUid> VampireMinds = new();

/*
public readonly List<ProtoId<EntityPrototype>> Objectives = new()

public readonly List<ProtoId<EntityPrototype>> BaseObjectives = new()
{
"VampireKillRandomPersonObjective",
"VampireDrainObjective"
};

public readonly List<ProtoId<EntityPrototype>> EscapeObjectives = new()
{
"ChangelingSurviveObjective",
"ChangelingStealDNAObjective",
"EscapeIdentityObjective"
}; */
"VampireSurviveObjective",
"VampireEscapeObjective"
};
}
12 changes: 10 additions & 2 deletions Content.Server/GameTicking/Rules/VampireRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,17 @@ public bool MakeVampire(EntityUid target, VampireRuleComponent rule)

if (HasComp<VampireComponent>(target))
_vampire.AddStartingAbilities(target);

Random random = new Random();

//foreach (var objective in rule.Objectives)
// _mind.TryAddObjective(mindId, mind, objective);
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);
}

return true;
}
Expand Down
9 changes: 9 additions & 0 deletions Content.Server/Objectives/Components/BloodDrainCondition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Server.Vampire;
using Content.Server.Objectives.Systems;

namespace Content.Server.Objectives.Components;

[RegisterComponent, Access(typeof(VampireSystem))]
public sealed partial class BloodDrainConditionComponent : Component
{
}
26 changes: 26 additions & 0 deletions Content.Server/Vampire/VampireSystem.Objectives.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Server.Objectives.Components;
using Content.Server.Objectives.Systems;
using Content.Shared.Objectives.Components;
using Content.Shared.Vampire.Components;
using Content.Shared.Vampire;

namespace Content.Server.Vampire;

public sealed partial class VampireSystem
{
[Dependency] private readonly NumberObjectiveSystem _number = default!;

private void InitializeObjectives()
{

SubscribeLocalEvent<BloodDrainConditionComponent, ObjectiveGetProgressEvent>(OnBloodDrainGetProgress);
}

private void OnBloodDrainGetProgress(EntityUid uid, BloodDrainConditionComponent comp, ref ObjectiveGetProgressEvent args)
{
var target = _number.GetTarget(uid);
if (target != 0 && TryComp<VampireComponent>(uid, out var vampirecomp))
args.Progress = MathF.Min(vampirecomp.TotalBloodDrank / target, 1f);
else args.Progress = 1f;
}
}
1 change: 1 addition & 0 deletions Content.Server/Vampire/VampireSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public override void Initialize()
SubscribeLocalEvent<VampireComponent, VampireMutationPrototypeSelectedMessage>(OnMutationSelected);

InitializePowers();
InitializeObjectives();
}

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions Resources/Locale/ru-RU/_prototypes/objectives/vampire.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ent-VampireSurviveObjective = Выжить
.desc = Я должен выжить, чего бы этого мне не стоило.
ent-VampireEscapeObjective = Улететь со станции живым и свободным.
.desc = Я должен улететь на эвакуационном шаттле. Свободным.
7 changes: 6 additions & 1 deletion Resources/Locale/ru-RU/_strings/Vampires/vampires.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ vampire-mutation-bestia-info =
Способности:
- Форма летучей мыши
- Мышиная форма
- Мышиная форма
## Objectives

objective-condition-drain-title = Выпить { $count } крови.
objective-condition-drain-description = Я должен выпить { $count } крови. Это необходимо для моего выживания и дальнейшей эволюции.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vampire-roundend-name = вампир
objective-issuer-vampire = [color=orange]Коллективный разум[/color]
objective-issuer-vampire = [color=red]Жажда крови[/color]
roundend-prepend-vampire-drained-named = [color=white]{ $name }[/color] выпил в общей сложности [color=red]{ $number }[/color] крови.
roundend-prepend-vampire-absorbed = Кто-то выпил в общей сложности [color=red]{ $number }[/color] крови.
vampire-gamemode-title = Вампиры
Expand Down
23 changes: 0 additions & 23 deletions Resources/Prototypes/Entities/Objects/Misc/heirloom.yml

This file was deleted.

4 changes: 4 additions & 0 deletions Resources/Prototypes/GameRules/midround.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
parent: BaseGameRule
id: Vampire
components:
- type: AntagRandomObjectives
sets:
- groups: VampireObjectiveGroupSteal
maxDifficulty: 10
- type: VampireRule
- type: AntagSelection
agentName: vampire-roundend-name
Expand Down
14 changes: 14 additions & 0 deletions Resources/Prototypes/Objectives/objectiveGroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,19 @@
id: ThiefObjectiveGroupEscape
weights:
EscapeThiefShuttleObjective: 1

# Vampire

- type: weightedRandom
id: VampireObjectiveGroupSteal
weights:
CMOHyposprayVampireStealObjective: 1
RDHardsuitVampireStealObjective: 1
EnergyShotgunVampireStealObjective: 1
MagbootsVampireStealObjective: 1
ClipboardVampireStealObjective: 1
CaptainIDVampireStealObjective: 1
CaptainJetpackVampireStealObjective: 1
CaptainGunVampireStealObjective: 1

#Crew, wizard, when you code it...
171 changes: 171 additions & 0 deletions Resources/Prototypes/Objectives/vampire.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Base

- type: entity
abstract: true
parent: BaseObjective
id: BaseVampireObjective
components:
- type: Objective
difficulty: 1.5
issuer: objective-issuer-vampire
- type: RoleRequirement
roles:
mindRoles:
- VampireRole

- type: entity
abstract: true
parent: [BaseVampireObjective, BaseStealObjective]
id: BaseVampireStealObjective
components:
- type: StealCondition
verifyMapExistence: false
- type: Objective
difficulty: 1.5
- type: ObjectiveLimit
limit: 2

# Steal

- type: entity
parent: BaseVampireStealObjective
id: CMOHyposprayVampireStealObjective
components:
- type: NotJobRequirement
job: ChiefMedicalOfficer
- type: StealCondition
owner: job-name-cmo
stealGroup: Hypospray

- type: entity
parent: BaseVampireStealObjective
id: RDHardsuitVampireStealObjective
components:
- type: NotJobRequirement
job: ResearchDirector
- type: StealCondition
owner: job-name-rd
stealGroup: ClothingOuterHardsuitRd
- type: Objective
difficulty: 1

- type: entity
parent: BaseVampireStealObjective
id: EnergyShotgunVampireStealObjective
components:
- type: Objective
difficulty: 2
- type: NotJobRequirement
job: HeadOfSecurity
- type: StealCondition
stealGroup: WeaponEnergyShotgun
owner: job-name-hos

- type: entity
parent: BaseVampireStealObjective
id: MagbootsVampireStealObjective
components:
- type: NotJobRequirement
job: ChiefEngineer
- type: StealCondition
stealGroup: ClothingShoesBootsMagAdv
owner: job-name-ce

- type: entity
parent: BaseVampireStealObjective
id: ClipboardVampireStealObjective
components:
- type: NotJobRequirement
job: Quartermaster
- type: StealCondition
stealGroup: BoxFolderQmClipboard
owner: job-name-qm

- type: entity
abstract: true
parent: BaseVampireStealObjective
id: BaseCaptainVampireObjective
components:
- type: Objective
difficulty: 2.5
- type: NotJobRequirement
job: Captain

- type: entity
parent: BaseCaptainVampireObjective
id: CaptainIDVampireStealObjective
components:
- type: StealCondition
stealGroup: CaptainIDCard

- type: entity
parent: BaseCaptainVampireObjective
id: CaptainJetpackVampireStealObjective
components:
- type: StealCondition
stealGroup: JetpackCaptainFilled

- type: entity
parent: BaseCaptainVampireObjective
id: CaptainGunVampireStealObjective
components:
- type: StealCondition
stealGroup: WeaponAntiqueLaser
owner: job-name-captain

# 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: deathsembrace

- type: entity
parent: [BaseVampireObjective, BaseLivingObjective]
id: VampireEscapeObjective
name: Escape to centcomm alive and unrestrained.
description: I need to escape on the evacuation shuttle. Undercover.
components:
- type: Objective
difficulty: 1.3
icon:
sprite: Structures/Furniture/chairs.rsi
state: shuttle
- type: EscapeShuttleCondition

# Kill

- type: entity
parent: [BaseVampireObjective, BaseKillObjective]
id: VampireKillRandomPersonObjective
description: Do it however you like, just make sure they don't make it to centcomm.
components:
- type: Objective
difficulty: 1.75
unique: false
- type: TargetObjective
title: objective-condition-kill-person-title
- type: PickRandomPerson

# Drain

- type: entity
parent: BaseVampireObjective
id: VampireDrainObjective
components:
- type: Objective
icon:
sprite: Interface/Actions/actions_vampire.rsi
state: fangs_extended
- type: NumberObjective
min: 100
max: 500
title: objective-condition-drain-title
description: objective-condition-drain-description
- type: BloodDrainCondition

0 comments on commit 7292014

Please sign in to comment.