mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-26 01:50:36 +00:00
yasc messages
This commit is contained in:
parent
a28c62416f
commit
285c71e10f
@ -1111,11 +1111,11 @@ EX bool should_switchplace(cell *c1, cell *c2) {
|
||||
EX bool switchplace_prevent(cell *c1, cell *c2, struct pcmove& m) {
|
||||
if(!should_switchplace(c1, c2)) return false;
|
||||
if(peace::on && (isMultitile(c2->monst) || saved_tortoise_on(c2) || isDie(c2->monst))) {
|
||||
if(m.vmsg(miRESTRICTED)) addMessage(XLAT("Cannot switch places with %the1!", c2->monst));
|
||||
if(m.vmsg(miRESTRICTED, siMONSTER, c2, c2->monst)) addMessage(XLAT("Cannot switch places with %the1!", c2->monst));
|
||||
return true;
|
||||
}
|
||||
if(c1->monst && c1->monst != moFriendlyIvy) {
|
||||
if(m.vmsg(miRESTRICTED)) addMessage(XLAT("There is no room for %the1!", c2->monst));
|
||||
if(m.vmsg(miRESTRICTED, siMONSTER, c1, c1->monst)) addMessage(XLAT("There is no room for %the1!", c2->monst));
|
||||
return true;
|
||||
}
|
||||
if(passable(c1, c2, P_ISFRIEND | (c2->monst == moTameBomberbird ? P_FLYING : 0))) return false;
|
||||
|
124
checkmove.cpp
124
checkmove.cpp
@ -27,29 +27,49 @@ EX bool canmove = true;
|
||||
|
||||
// how many monsters are near
|
||||
EX eMonster who_kills_me;
|
||||
EX cell *who_kills_me_cell;
|
||||
|
||||
EX int lastkills;
|
||||
|
||||
EX vector<bool> legalmoves;
|
||||
|
||||
/* why is a move illegal */
|
||||
EX vector<int> move_issues;
|
||||
|
||||
#if HDR
|
||||
struct moveissue {
|
||||
int type;
|
||||
int subtype;
|
||||
eMonster monster;
|
||||
cell *where;
|
||||
};
|
||||
|
||||
static constexpr int miVALID = 10000;
|
||||
static constexpr int miENTITY = 11000;
|
||||
static constexpr int miRESTRICTED = 10100;
|
||||
static constexpr int miTHREAT = 10010;
|
||||
static constexpr int miWALL = 10001;
|
||||
|
||||
static constexpr int siWALL = 1;
|
||||
static constexpr int siMONSTER = 2;
|
||||
static constexpr int siGRAVITY = 3;
|
||||
static constexpr int siROSE = 4;
|
||||
static constexpr int siITEM = 5;
|
||||
static constexpr int siWIND = 6;
|
||||
static constexpr int siCURRENT = 7;
|
||||
static constexpr int siFATIGUE = 8;
|
||||
static constexpr int siWARP = 9;
|
||||
static constexpr int siUNKNOWN = 10;
|
||||
#endif
|
||||
|
||||
EX int checked_move_issue;
|
||||
/* why is a move illegal */
|
||||
EX vector<moveissue> move_issues;
|
||||
|
||||
EX moveissue checked_move_issue;
|
||||
EX moveissue stay_issue;
|
||||
EX int yasc_code;
|
||||
|
||||
EX void check_if_monster() {
|
||||
eMonster m = cwt.peek()->monst;
|
||||
if(m && m != passive_switch && !isFriendly(m))
|
||||
checked_move_issue = miENTITY;
|
||||
checked_move_issue = moveissue { miENTITY, siMONSTER, m, cwt.peek() };
|
||||
}
|
||||
|
||||
EX bool hasSafeOrb(cell *c) {
|
||||
@ -108,14 +128,14 @@ EX bool monstersnear(cell *c, eMonster who) {
|
||||
bool kraken_will_destroy_boat = false;
|
||||
|
||||
elec::builder b;
|
||||
if(elec::affected(c)) { who_kills_me = moLightningBolt; res++; }
|
||||
if(elec::affected(c)) { who_kills_me = moLightningBolt; who_kills_me_cell = nullptr; res++; }
|
||||
|
||||
if(c->wall == waArrowTrap && c->wparam == 2) {
|
||||
who_kills_me = moArrowTrap; res++;
|
||||
who_kills_me = moArrowTrap; who_kills_me_cell = nullptr; res++;
|
||||
}
|
||||
|
||||
for(auto c1: crush_now) if(c == c1) {
|
||||
who_kills_me = moCrusher; res++;
|
||||
who_kills_me = moCrusher; who_kills_me_cell = nullptr; res++;
|
||||
}
|
||||
|
||||
if(who == moPlayer || items[itOrbEmpathy]) {
|
||||
@ -126,7 +146,7 @@ EX bool monstersnear(cell *c, eMonster who) {
|
||||
if(havewhat&HF_OUTLAW) {
|
||||
for(cell *c1: gun_targets(c))
|
||||
if(c1->monst == moOutlaw && !c1->stuntime) {
|
||||
res++; who_kills_me = moOutlaw;
|
||||
res++; who_kills_me = moOutlaw; who_kills_me_cell = c1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +177,7 @@ EX bool monstersnear(cell *c, eMonster who) {
|
||||
}
|
||||
// flashwitches cannot attack if it would kill another enemy
|
||||
if(c3->monst == moWitchFlash && flashWouldKill(c3, 0)) continue;
|
||||
res++, who_kills_me = c3->monst;
|
||||
res++, who_kills_me = c3->monst; who_kills_me_cell = c3;
|
||||
}
|
||||
|
||||
// consider normal monsters
|
||||
@ -179,12 +199,12 @@ EX bool monstersnear(cell *c, eMonster who) {
|
||||
eaten = true;
|
||||
else if(c2->monst != moHexSnake) continue;
|
||||
}
|
||||
res++, who_kills_me = m;
|
||||
res++, who_kills_me = m; who_kills_me_cell = c2;
|
||||
}
|
||||
}
|
||||
|
||||
if(kraken_will_destroy_boat && !krakensafe(c) && warningprotection(XLAT("This move appears dangerous -- are you sure?"))) {
|
||||
if (res == 0) who_kills_me = moWarning;
|
||||
if (res == 0) who_kills_me = moWarning; who_kills_me_cell = nullptr;
|
||||
res++;
|
||||
} else {
|
||||
if(who == moPlayer && res && (markOrb2(itOrbShield) || markOrb2(itOrbShell)) && !eaten)
|
||||
@ -239,7 +259,7 @@ EX bool monstersnear_aux() {
|
||||
/** like monstersnear but add the potential moves of other players into account */
|
||||
EX bool monstersnear_add_pmi(player_move_info pmi0) {
|
||||
if(suicidal) {
|
||||
who_kills_me = moPlayer;
|
||||
who_kills_me = moPlayer; who_kills_me_cell = nullptr;
|
||||
return true;
|
||||
}
|
||||
pmi.push_back(pmi0);
|
||||
@ -280,6 +300,78 @@ EX bool swordConflict(const player_move_info& sm1, const player_move_info& sm2)
|
||||
return false;
|
||||
}
|
||||
|
||||
EX string yasc_message;
|
||||
|
||||
EX void create_yasc_message() {
|
||||
set<pair<cell*, eMonster>> captures;
|
||||
auto all = move_issues;
|
||||
all.push_back(stay_issue);
|
||||
for(auto c: all) if(c.type == miTHREAT) captures.emplace(c.where, c.monster);
|
||||
|
||||
vector<string> context;
|
||||
if(!captures.empty()) {
|
||||
string msg = "captured by ";
|
||||
map<eMonster, int> qties;
|
||||
for(auto ca: captures) qties[ca.second]++;
|
||||
int iqties = 0;
|
||||
for(auto q: qties) {
|
||||
if(iqties && iqties == isize(qties) - 1) msg += " and ";
|
||||
else if(iqties) msg += ", ";
|
||||
msg += dnameof(q.first);
|
||||
if(q.second > 1) msg += " (x" + its(q.second) + ")";
|
||||
iqties++;
|
||||
}
|
||||
context.push_back(msg);
|
||||
}
|
||||
|
||||
int idx = 0;
|
||||
for(auto c: all) if(idx == 0 && c.subtype == siROSE) context.push_back("rosed"), idx = 1;
|
||||
for(auto c: all) if(idx < 2 && c.subtype == siWIND) context.push_back("blown away"), idx = 2;
|
||||
for(auto c: all) if(idx < 3 && c.subtype == siGRAVITY) context.push_back("falling"), idx = 3;
|
||||
for(auto c: all) if(idx < 4 && c.subtype == siFATIGUE) context.push_back("fatigued"), idx = 4;
|
||||
for(auto c: all) if(idx < 5 && c.subtype == siCURRENT) context.push_back("whirled"), idx = 5;
|
||||
|
||||
bool in_ctx = true;
|
||||
|
||||
set<string> blocks;
|
||||
int index = 0;
|
||||
for(auto c: all) {
|
||||
if(c.type == miENTITY && !captures.count({c.where, c.monster})) blocks.insert(dnameof(c.monster));
|
||||
if(c.subtype == siITEM) blocks.insert("item");
|
||||
if(c.subtype == siWALL) {
|
||||
if(c.where == cwt.at) { if(in_ctx) context.push_back("in " + dnameof(c.where->wall)); in_ctx = false; }
|
||||
else if(c.where && c.where->wall != cwt.at->wall) blocks.insert(dnameof(c.where->wall));
|
||||
}
|
||||
if(c.type == siWARP) blocks.insert("warp");
|
||||
index++;
|
||||
}
|
||||
|
||||
if(!blocks.empty()) {
|
||||
string block = "blocked by ";
|
||||
int iqties = 0;
|
||||
for(auto& q: blocks) {
|
||||
if(iqties && iqties == isize(blocks) - 1) block += " and ";
|
||||
else if(iqties) block += ", ";
|
||||
block += q;
|
||||
iqties++;
|
||||
}
|
||||
context.push_back(block);
|
||||
}
|
||||
|
||||
yasc_message = "";
|
||||
int iqties = 0;
|
||||
for(auto& ctx: context) {
|
||||
if(iqties == 0) ;
|
||||
else if(iqties == 1) yasc_message += " while ";
|
||||
else if(iqties == isize(context) - 1) yasc_message += " and ";
|
||||
else yasc_message += ", ";
|
||||
yasc_message += ctx;
|
||||
iqties++;
|
||||
}
|
||||
|
||||
println(hlog, "YASC_MESSAGE: ", yasc_message);
|
||||
}
|
||||
|
||||
EX void checkmove() {
|
||||
|
||||
if(dual::state == 2) return;
|
||||
@ -295,12 +387,13 @@ EX void checkmove() {
|
||||
if(hardcore) return;
|
||||
|
||||
legalmoves.clear(); legalmoves.resize(cwt.at->type+1, false);
|
||||
move_issues.clear(); move_issues.resize(cwt.at->type, 0);
|
||||
move_issues.clear(); move_issues.resize(cwt.at->type);
|
||||
|
||||
canmove = haveRangedTarget();
|
||||
items[itWarning]+=2;
|
||||
if(movepcto(-1, 0, true))
|
||||
canmove = legalmoves[cwt.at->type] = true;
|
||||
stay_issue = checked_move_issue;
|
||||
|
||||
if(true) {
|
||||
for(int i=0; i<cwt.at->type; i++) {
|
||||
@ -323,7 +416,7 @@ EX void checkmove() {
|
||||
|
||||
yasc_code = 0;
|
||||
for(int i=0; i<cwt.at->type; i++)
|
||||
yasc_code += move_issues[i];
|
||||
yasc_code += move_issues[i].type;
|
||||
|
||||
#if CAP_INV
|
||||
if(inv::on && !canmove && !inv::incheck) {
|
||||
@ -342,6 +435,7 @@ EX void checkmove() {
|
||||
if(!canmove && bow::crossbow_mode() && !items[itCrossbow]) canmove = bow::have_bow_target();
|
||||
|
||||
if(!canmove) {
|
||||
create_yasc_message();
|
||||
achievement_final(true);
|
||||
if(cmode & sm::NORMAL) showMissionScreen();
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ EX void add_fire(cell *c) {
|
||||
return;
|
||||
}
|
||||
clear_bowpath();
|
||||
checked_move_issue = miVALID;
|
||||
checked_move_issue.type = miVALID;
|
||||
pcmove pcm;
|
||||
pcm.checkonly = false;
|
||||
changes.init(false);
|
||||
@ -358,7 +358,7 @@ EX bool fire_on_mouse(cell *c) {
|
||||
return false;
|
||||
}
|
||||
gen_bowpath_map();
|
||||
checked_move_issue = miVALID;
|
||||
checked_move_issue.type = miVALID;
|
||||
pcmove pcm;
|
||||
pcm.checkonly = false;
|
||||
changes.init(false);
|
||||
@ -514,7 +514,7 @@ EX bool have_bow_target() {
|
||||
int res = create_path();
|
||||
if(res == -1) continue;
|
||||
|
||||
checked_move_issue = miVALID;
|
||||
checked_move_issue.type = miVALID;
|
||||
pcmove pcm;
|
||||
pcm.checkonly = true;
|
||||
changes.init(true);
|
||||
|
97
pcmove.cpp
97
pcmove.cpp
@ -119,7 +119,7 @@ bool pcmove::checkNeedMove(bool checkonly, bool attacking) {
|
||||
return false;
|
||||
int flags = 0;
|
||||
if(cwt.at->monst) {
|
||||
if(vmsg(miRESTRICTED)) {
|
||||
if(vmsg(miRESTRICTED, siMONSTER, cwt.at, cwt.at->monst)) {
|
||||
if(isMountable(cwt.at->monst))
|
||||
addMessage(XLAT("You need to dismount %the1!", cwt.at->monst));
|
||||
else
|
||||
@ -128,7 +128,7 @@ bool pcmove::checkNeedMove(bool checkonly, bool attacking) {
|
||||
}
|
||||
else if(cwt.at->wall == waRoundTable) {
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siWALL, cwt.at, moNone))
|
||||
addMessage(XLAT("It would be impolite to land on the table!"));
|
||||
}
|
||||
else if(cwt.at->wall == waLake) {
|
||||
@ -136,48 +136,48 @@ bool pcmove::checkNeedMove(bool checkonly, bool attacking) {
|
||||
if(markOrb2(itOrbFish)) return false;
|
||||
if(in_gravity_zone(cwt.at) && passable(cwt.at, NULL, P_ISPLAYER)) return false;
|
||||
flags |= AF_FALL;
|
||||
if(vmsg(miWALL)) addMessage(XLAT("Ice below you is melting! RUN!"));
|
||||
if(vmsg(miWALL, siWALL, cwt.at, moNone)) addMessage(XLAT("Ice below you is melting! RUN!"));
|
||||
}
|
||||
else if(!attacking && cellEdgeUnstable(cwt.at)) {
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(in_gravity_zone(cwt.at) && passable(cwt.at, NULL, P_ISPLAYER)) return false;
|
||||
if(vmsg(miRESTRICTED)) addMessage(XLAT("Nothing to stand on here!"));
|
||||
if(vmsg(miRESTRICTED, siGRAVITY, cwt.at, moNone)) addMessage(XLAT("Nothing to stand on here!"));
|
||||
return true;
|
||||
}
|
||||
else if(among(cwt.at->wall, waSea, waCamelotMoat, waLake, waDeepWater)) {
|
||||
if(markOrb(itOrbFish)) return false;
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(in_gravity_zone(cwt.at) && passable(cwt.at, NULL, P_ISPLAYER)) return false;
|
||||
if(vmsg(miWALL)) addMessage(XLAT("You have to run away from the water!"));
|
||||
if(vmsg(miWALL, siWALL, cwt.at, moNone)) addMessage(XLAT("You have to run away from the water!"));
|
||||
}
|
||||
else if(cwt.at->wall == waClosedGate) {
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(vmsg(miWALL)) addMessage(XLAT("The gate is closing right on you! RUN!"));
|
||||
if(vmsg(miWALL, siWALL, cwt.at, moNone)) addMessage(XLAT("The gate is closing right on you! RUN!"));
|
||||
}
|
||||
else if(isFire(cwt.at) && !markOrb(itOrbWinter) && !markOrb(itCurseWater) && !markOrb2(itOrbShield)) {
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(vmsg(miWALL)) addMessage(XLAT("This spot will be burning soon! RUN!"));
|
||||
if(vmsg(miWALL, siWALL, cwt.at, moNone)) addMessage(XLAT("This spot will be burning soon! RUN!"));
|
||||
}
|
||||
else if(cwt.at->wall == waMagma && !markOrb(itOrbWinter) && !markOrb(itCurseWater) && !markOrb2(itOrbShield)) {
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(in_gravity_zone(cwt.at) && passable(cwt.at, cwt.at, P_ISPLAYER)) return false;
|
||||
if(vmsg(miWALL)) addMessage(XLAT("Run away from the lava!"));
|
||||
if(vmsg(miWALL, siWALL, cwt.at, moNone)) addMessage(XLAT("Run away from the lava!"));
|
||||
}
|
||||
else if(cwt.at->wall == waChasm) {
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(in_gravity_zone(cwt.at) && passable(cwt.at, cwt.at, P_ISPLAYER)) return false;
|
||||
flags |= AF_FALL;
|
||||
if(vmsg(miWALL)) addMessage(XLAT("The floor has collapsed! RUN!"));
|
||||
if(vmsg(miWALL, siWALL, cwt.at, moNone)) addMessage(XLAT("The floor has collapsed! RUN!"));
|
||||
}
|
||||
else if(items[itOrbAether] > ORBBASE && !passable(cwt.at, NULL, P_ISPLAYER | P_NOAETHER)) {
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
vmsg(miWALL);
|
||||
vmsg(miWALL, siWALL, cwt.at, moNone);
|
||||
return true;
|
||||
}
|
||||
else if(!passable(cwt.at, NULL, P_ISPLAYER)) {
|
||||
if(isFire(cwt.at)) return false; // already checked: have Shield
|
||||
if(markOrb2(itOrbAether)) return false;
|
||||
if(vmsg(miWALL)) addMessage(XLAT("Your Aether power has expired! RUN!"));
|
||||
if(vmsg(miWALL, siWALL, cwt.at, moNone)) addMessage(XLAT("Your Aether power has expired! RUN!"));
|
||||
}
|
||||
else return false;
|
||||
if(hardcore && !checkonly)
|
||||
@ -226,16 +226,33 @@ struct pcmove {
|
||||
movei mi, mip;
|
||||
pcmove() : mi(nullptr, nullptr, 0), mip(nullptr, nullptr, 0) {}
|
||||
|
||||
bool vmsg(int code);
|
||||
bool vmsg(moveissue mi);
|
||||
|
||||
bool vmsg(int code, int subissue_code, cell *where, eMonster m) {
|
||||
moveissue mi;
|
||||
mi.type = code;
|
||||
mi.subtype = subissue_code;
|
||||
mi.monster = m;
|
||||
mi.where = where;
|
||||
return vmsg(mi);
|
||||
}
|
||||
|
||||
bool vmsg_threat() {
|
||||
return vmsg(miTHREAT, siMONSTER, who_kills_me_cell, who_kills_me);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
EX cell *global_pushto;
|
||||
|
||||
bool pcmove::vmsg(int code) { checked_move_issue = code; changes.rollback(); return errormsgs && !checkonly; }
|
||||
bool pcmove::vmsg(moveissue mi) {
|
||||
checked_move_issue = mi;
|
||||
changes.rollback();
|
||||
return errormsgs && !checkonly;
|
||||
}
|
||||
|
||||
EX bool movepcto(int d, int subdir IS(1), bool checkonly IS(false)) {
|
||||
checked_move_issue = miVALID;
|
||||
checked_move_issue.type = miVALID;
|
||||
pcmove pcm;
|
||||
pcm.checkonly = checkonly;
|
||||
pcm.d = d; pcm.subdir = subdir;
|
||||
@ -287,7 +304,7 @@ bool pcmove::try_shooting(bool auto_target) {
|
||||
playerMoveEffects(mi);
|
||||
|
||||
if(monstersnear_add_pmi(mi)) {
|
||||
if(vmsg(miTHREAT)) wouldkill("%The1 would catch you!");
|
||||
if(vmsg_threat()) wouldkill("%The1 would catch you!");
|
||||
return false;
|
||||
}
|
||||
if(checkonly) return true;
|
||||
@ -330,7 +347,7 @@ bool pcmove::movepcto() {
|
||||
if(againstRose(cwt.at, NULL) && d<0 && !scentResistant()) {
|
||||
fatigued = items[itFatigue] >= 8;
|
||||
if(!fatigued) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siROSE, nullptr, moNone))
|
||||
addMessage(XLAT("You just cannot stand in place, those roses smell too nicely."));
|
||||
return false;
|
||||
}
|
||||
@ -444,7 +461,7 @@ bool pcmove::swing() {
|
||||
mirror::act(origd, mirror::SPINMULTI | mirror::ATTACK);
|
||||
|
||||
if(monstersnear_add_pmi(movei(cwt.at, STAY))) {
|
||||
if(vmsg(miTHREAT))
|
||||
if(vmsg_threat())
|
||||
wouldkill("You would be killed by %the1!");
|
||||
return false;
|
||||
}
|
||||
@ -724,7 +741,7 @@ bool pcmove::actual_move() {
|
||||
}
|
||||
|
||||
if(againstRose(cwt.at, c2) && !scentResistant()) {
|
||||
if(vmsg(miRESTRICTED)) addMessage("Those roses smell too nicely. You have to come towards them.");
|
||||
if(vmsg(miRESTRICTED, siROSE, nullptr, moNone)) addMessage("Those roses smell too nicely. You have to come towards them.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -763,7 +780,7 @@ bool pcmove::actual_move() {
|
||||
mip = determinePush(cwt, subdir, [] (movei mi) { return canPushThumperOn(mi, cwt.at); });
|
||||
if(mip.t) changes.ccell(mip.t);
|
||||
if(mip.d == NO_SPACE) {
|
||||
if(vmsg(miWALL)) addMessage(XLAT("No room to push %the1.", c2->wall));
|
||||
if(vmsg(miWALL, siWALL, c2, moNone)) addMessage(XLAT("No room to push %the1.", c2->wall));
|
||||
return false;
|
||||
}
|
||||
nextmovetype = lmMove;
|
||||
@ -775,7 +792,7 @@ bool pcmove::actual_move() {
|
||||
}
|
||||
|
||||
if(c2->item == itHolyGrail && roundTableRadius(c2) < newRoundTableRadius()) {
|
||||
if(vmsg(miRESTRICTED)) addMessage(XLAT("That was not a challenge. Find a larger castle!"));
|
||||
if(vmsg(miRESTRICTED, siITEM, c2, moNone)) addMessage(XLAT("That was not a challenge. Find a larger castle!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -815,21 +832,21 @@ bool pcmove::boat_move() {
|
||||
cell *& c2 = mi.t;
|
||||
|
||||
if(againstWind(c2, cwt.at)) {
|
||||
if(vmsg(miRESTRICTED)) blowaway_message(c2);
|
||||
if(vmsg(miRESTRICTED, siWIND, c2, moNone)) blowaway_message(c2);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(againstCurrent(c2, cwt.at) && !markOrb(itOrbWater)) {
|
||||
if(markOrb(itOrbFish) || markOrb(itOrbAether) || gravity_state)
|
||||
return after_escape();
|
||||
if(vmsg(miRESTRICTED)) addMessage(XLAT("You cannot go against the current!"));
|
||||
if(vmsg(miRESTRICTED, siCURRENT, c2, moNone)) addMessage(XLAT("You cannot go against the current!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(cwt.at->item == itOrbYendor) {
|
||||
if(markOrb(itOrbFish) || markOrb(itOrbAether) || gravity_state)
|
||||
return after_escape();
|
||||
if(vmsg(miRESTRICTED)) addMessage(XLAT("The Orb of Yendor is locked in with powerful magic."));
|
||||
if(vmsg(miRESTRICTED, siITEM, c2, moNone)) addMessage(XLAT("The Orb of Yendor is locked in with powerful magic."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -904,7 +921,7 @@ bool pcmove::after_escape() {
|
||||
if(push_behind && !c2->monst && !nonAdjacentPlayer(c2, cwt.at) && fmsMove) {
|
||||
eWall what = c2->wall;
|
||||
if(!thruVine(c2, cwt.at) && !canPushStatueOn(cwt.at, P_ISPLAYER)) {
|
||||
if(vmsg(miRESTRICTED)) {
|
||||
if(vmsg(miRESTRICTED, siWALL, c2, moNone)) {
|
||||
if(isFire(cwt.at))
|
||||
addMessage(XLAT("You have to escape first!"));
|
||||
else
|
||||
@ -988,7 +1005,7 @@ bool pcmove::after_escape() {
|
||||
}
|
||||
else if(c2->monst == moKnight) {
|
||||
#if CAP_COMPLEX2
|
||||
if(vmsg(miWALL)) camelot::knightFlavorMessage(c2);
|
||||
if(vmsg(miWALL, siMONSTER, c2, c2->monst)) camelot::knightFlavorMessage(c2);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -999,7 +1016,7 @@ bool pcmove::after_escape() {
|
||||
return false;
|
||||
}
|
||||
else if(markOrb(itCurseFatigue) && items[itFatigue] + fatigue_cost(mi) > 10) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siFATIGUE, nullptr, moNone))
|
||||
addMessage(XLAT("You are too fatigued!"));
|
||||
return false;
|
||||
}
|
||||
@ -1035,41 +1052,41 @@ bool pcmove::move_if_okay() {
|
||||
void pcmove::tell_why_impassable() {
|
||||
cell*& c2 = mi.t;
|
||||
if(nonAdjacentPlayer(cwt.at,c2)) {
|
||||
if(vmsg(miRESTRICTED)) addMessage(geosupport_football() < 2 ?
|
||||
if(vmsg(miRESTRICTED, siWARP, c2, moNone)) addMessage(geosupport_football() < 2 ?
|
||||
XLAT("You cannot move between the cells without dots here!") :
|
||||
XLAT("You cannot move between the triangular cells here!")
|
||||
);
|
||||
}
|
||||
else if(againstWind(c2, cwt.at)) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siWIND, c2, moNone))
|
||||
blowaway_message(c2);
|
||||
}
|
||||
else if(anti_alchemy(c2, cwt.at)) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siWALL, c2, moNone))
|
||||
addMessage(XLAT("Wrong color!"));
|
||||
}
|
||||
else if(c2->wall == waRoundTable) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siWALL, c2, moNone))
|
||||
addMessage(XLAT("It would be impolite to land on the table!"));
|
||||
}
|
||||
else if(snakelevel(cwt.at) >= 3 && snakelevel(c2) == 0 && !isWall(c2)) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siWALL, cwt.at, moNone))
|
||||
addMessage(XLAT("You would get hurt!", c2->wall));
|
||||
}
|
||||
else if(cellEdgeUnstable(cwt.at) && cellEdgeUnstable(c2)) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siGRAVITY, c2, moNone))
|
||||
addMessage(XLAT("Gravity does not allow this!"));
|
||||
}
|
||||
else if(c2->wall == waChasm && c2->land == laDual) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siWALL, c2, moNone))
|
||||
addMessage(XLAT("You cannot move there!"));
|
||||
}
|
||||
else if(!c2->wall) {
|
||||
if(vmsg(miRESTRICTED))
|
||||
if(vmsg(miRESTRICTED, siUNKNOWN, c2, moNone))
|
||||
addMessage(XLAT("You cannot move there!"));
|
||||
}
|
||||
else {
|
||||
if(vmsg(miWALL))
|
||||
if(vmsg(miWALL, siWALL, c2, moNone))
|
||||
addMessage(XLAT("You cannot move through %the1!", c2->wall));
|
||||
}
|
||||
}
|
||||
@ -1091,14 +1108,14 @@ bool pcmove::attack() {
|
||||
if(!ca) {
|
||||
if(forcedmovetype == fmAttack) {
|
||||
if(monstersnear_add_pmi(movei(cwt.at, STAY))) {
|
||||
if(vmsg(miTHREAT)) wouldkill("%The1 would get you!");
|
||||
if(vmsg_threat()) wouldkill("%The1 would get you!");
|
||||
return false;
|
||||
}
|
||||
nextmovetype = lmSkip;
|
||||
addMessage(XLAT("You swing your sword at %the1.", c2->monst));
|
||||
return swing();
|
||||
}
|
||||
if(vmsg(miENTITY)) tell_why_cannot_attack();
|
||||
if(vmsg(miENTITY, siMONSTER, c2, c2->monst)) tell_why_cannot_attack();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1172,7 +1189,7 @@ bool pcmove::attack() {
|
||||
swordAttackStatic();
|
||||
|
||||
if(monstersnear_add_pmi(movei(cwt.at, STAY))) {
|
||||
if(vmsg(miTHREAT)) wouldkill("You would be killed by %the1!");
|
||||
if(vmsg_threat()) wouldkill("You would be killed by %the1!");
|
||||
return false;
|
||||
}
|
||||
if(checkonly) return true;
|
||||
@ -1312,7 +1329,7 @@ bool pcmove::perform_move_or_jump() {
|
||||
if(mi.t->monst == moFriendlyIvy) changes.ccell(mi.t), mi.t->monst = moNone;
|
||||
|
||||
if(monstersnear_add_pmi(pmi)) {
|
||||
if(vmsg(miTHREAT)) wouldkill("%The1 would kill you there!");
|
||||
if(vmsg_threat()) wouldkill("%The1 would kill you there!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1357,7 +1374,7 @@ bool pcmove::stay() {
|
||||
items[itFatigue] = 0;
|
||||
|
||||
if(monstersnear_add_pmi(mi)) {
|
||||
if(vmsg(miTHREAT)) wouldkill("%The1 would get you!");
|
||||
if(vmsg_threat()) wouldkill("%The1 would get you!");
|
||||
return false;
|
||||
}
|
||||
if(checkonly) return true;
|
||||
|
Loading…
Reference in New Issue
Block a user