-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathevents-assassination.cpp
111 lines (95 loc) · 2.72 KB
/
events-assassination.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// START A3HEADER
//
// This source file is part of the Atlantis PBM game program.
// Copyright (C) 2022 Valdis Zobēla
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program, in the file license.txt. If not, write
// to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
//
// See the Atlantis Project web page for details:
// http://www.prankster.com/project
//
// END A3HEADER
#include "events.h"
#include "gameio.h"
#include "astring.h"
#include <memory>
#include <stdexcept>
#include <sstream>
using namespace std;
AssassinationFact::AssassinationFact() {
this->location = EventLocation();
}
AssassinationFact::~AssassinationFact() {
}
const vector<string> SENTIMENT = {
"fearsome",
"alarming",
"horrifying",
"frightening",
"worrisome"
};
const vector<string> LOCALS = {
"citizens",
"inhabitants",
"locals",
"commoners"
};
const vector<string> FEELING = {
"shocked",
"stunned",
"horrified",
"terrified",
"afraid",
"scared"
};
void AssassinationFact::GetEvents(std::list<Event> &events) {
std::ostringstream buffer;
buffer
<< capitalize(oneOf(SENTIMENT))
<< " news were coming from the"
<< " " << this->location.GetTerrainName(true)
<< " of " << this->location.province
<< "."
;
buffer
<< " " << capitalize(oneOf(LOCALS))
<< " were " << oneOf(FEELING)
<< " by the assassination"
;
if (this->outcome != BATTLE_LOST) {
buffer << " attempt";
}
auto mark = this->location.GetSignificantLandmark();
if (mark) {
buffer
<< " " << (mark->distance == 0 ? "in" : "near")
<< " the " << mark->title;
}
if (this->outcome == BATTLE_LOST) {
buffer << ". The assassin escaped unnoticed.";
}
else if (this->outcome == BATTLE_DRAW) {
buffer << "; thankfully, the victim survived, but the assassin was able to escape unnoticed.";
}
else {
buffer << "; thankfully, the victim survived.";
}
events.push_back({
.category = EventCategory::EVENT_ASSASSINATION,
.score = 1,
.text = buffer.str()
});
}