1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-01 02:07:57 +00:00

yasc messages

This commit is contained in:
Zeno Rogue
2024-02-22 17:12:49 +01:00
parent a28c62416f
commit 285c71e10f
5 changed files with 172 additions and 60 deletions

View File

@@ -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;