mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-18 19:24:48 +00:00
in YASC messages, mention the knights blocking the way, and also mention their names
This commit is contained in:
parent
2379228ab4
commit
87ac19febe
@ -302,22 +302,29 @@ EX bool swordConflict(const player_move_info& sm1, const player_move_info& sm2)
|
|||||||
|
|
||||||
EX string yasc_message;
|
EX string yasc_message;
|
||||||
|
|
||||||
|
EX string blocking_monster_name(const moveissue& mi) {
|
||||||
|
if(mi.monster == moKnight && mi.where)
|
||||||
|
return XLAT("%1 the Knight", camelot::knight_name(mi.where));
|
||||||
|
else
|
||||||
|
return dnameof(mi.monster);
|
||||||
|
}
|
||||||
|
|
||||||
EX void create_yasc_message() {
|
EX void create_yasc_message() {
|
||||||
set<pair<cell*, eMonster>> captures;
|
set<pair<cell*, string>> captures;
|
||||||
auto all = move_issues;
|
auto all = move_issues;
|
||||||
all.push_back(stay_issue);
|
all.push_back(stay_issue);
|
||||||
for(auto c: all) if(c.type == miTHREAT) captures.emplace(c.where, c.monster);
|
for(auto c: all) if(c.type == miTHREAT) captures.emplace(c.where, blocking_monster_name(c));
|
||||||
|
|
||||||
vector<string> context;
|
vector<string> context;
|
||||||
if(!captures.empty()) {
|
if(!captures.empty()) {
|
||||||
string msg = "captured by ";
|
string msg = "captured by ";
|
||||||
map<eMonster, int> qties;
|
map<string, int> qties;
|
||||||
for(auto ca: captures) qties[ca.second]++;
|
for(auto ca: captures) qties[ca.second]++;
|
||||||
int iqties = 0;
|
int iqties = 0;
|
||||||
for(auto q: qties) {
|
for(auto q: qties) {
|
||||||
if(iqties && iqties == isize(qties) - 1) msg += " and ";
|
if(iqties && iqties == isize(qties) - 1) msg += " and ";
|
||||||
else if(iqties) msg += ", ";
|
else if(iqties) msg += ", ";
|
||||||
msg += dnameof(q.first);
|
msg += q.first;
|
||||||
if(q.second > 1) msg += " (x" + its(q.second) + ")";
|
if(q.second > 1) msg += " (x" + its(q.second) + ")";
|
||||||
iqties++;
|
iqties++;
|
||||||
}
|
}
|
||||||
@ -336,9 +343,10 @@ EX void create_yasc_message() {
|
|||||||
set<string> blocks;
|
set<string> blocks;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for(auto c: all) {
|
for(auto c: all) {
|
||||||
if(c.type == miENTITY && !captures.count({c.where, c.monster})) blocks.insert(dnameof(c.monster));
|
if(c.type == miENTITY && !captures.count({c.where, blocking_monster_name(c)})) blocks.insert(blocking_monster_name(c));
|
||||||
if(c.subtype == siITEM) blocks.insert("item");
|
else if(c.type == miWALL && c.subtype == siMONSTER && !captures.count({c.where, blocking_monster_name(c)})) blocks.insert(blocking_monster_name(c));
|
||||||
if(c.subtype == siWALL) {
|
else if(c.subtype == siITEM) blocks.insert("item");
|
||||||
|
else if(c.subtype == siWALL) {
|
||||||
if(c.where == cwt.at) {
|
if(c.where == cwt.at) {
|
||||||
if(in_ctx) {
|
if(in_ctx) {
|
||||||
if(c.where->wall == waNone && c.where->land == laBrownian)
|
if(c.where->wall == waNone && c.where->land == laBrownian)
|
||||||
@ -350,7 +358,7 @@ EX void create_yasc_message() {
|
|||||||
}
|
}
|
||||||
else if(c.where && c.where->wall != cwt.at->wall) blocks.insert(dnameof(c.where->wall));
|
else if(c.where && c.where->wall != cwt.at->wall) blocks.insert(dnameof(c.where->wall));
|
||||||
}
|
}
|
||||||
if(c.type == siWARP) blocks.insert("warp");
|
else if(c.type == siWARP) blocks.insert("warp");
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user