Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced Riding fix #228

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions code/code/cmd/cmd_get.cc
Expand Up @@ -356,7 +356,9 @@ int TBeing::doGet(const char *a)
if (fight())
return FALSE; // don't fall through
}
if (dynamic_cast<TBeing *>(riding)) {
if ((riding && dynamic_cast<TBeing *>(riding))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all these parentheses? We need none of them.

&& !(doesKnowSkill(SKILL_ADVANCED_RIDING)
&& (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))){
sendTo("You can't get things from the room while mounted!\n\r");
return FALSE;
}
Expand Down Expand Up @@ -385,7 +387,9 @@ int TBeing::doGet(const char *a)
if (fight())
return FALSE; // don't fall through
}
if (dynamic_cast<TBeing *>(riding)) {
if ((riding && dynamic_cast<TBeing *>(riding))
&& !(doesKnowSkill(SKILL_ADVANCED_RIDING)
&& (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))){
sendTo("You can't get things from the room while mounted!\n\r");
return FALSE;
}
Expand Down Expand Up @@ -434,7 +438,9 @@ int TBeing::doGet(const char *a)
if (getAllObjChecks(this))
return FALSE;

if (dynamic_cast<TBeing *>(riding)) {
if ((riding && dynamic_cast<TBeing *>(riding))
&& !(doesKnowSkill(SKILL_ADVANCED_RIDING)
&& (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))){
act("You can't get things from corpses while mounted!",
FALSE, this, NULL, 0, TO_CHAR);
return FALSE;
Expand Down Expand Up @@ -493,8 +499,10 @@ int TBeing::doGet(const char *a)
if (getAllObjChecks(this))
return FALSE;

if (dynamic_cast<TBeing *>(riding) &&
(sub->inRoom() != Room::NOWHERE)) {
if ((riding && dynamic_cast<TBeing *>(riding))
&& !(doesKnowSkill(SKILL_ADVANCED_RIDING)
&& (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))
&& (sub->inRoom() != Room::NOWHERE)) {
act("You can't get things from $p while mounted!",
FALSE, this, sub, 0, TO_CHAR);
return FALSE;
Expand Down
7 changes: 5 additions & 2 deletions code/code/disc/disc_monk.cc
Expand Up @@ -87,8 +87,7 @@ int task_yoginsa(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TOb
int learn, wohlin_learn;
int monk_level;

if (ch->isLinkdead() || (ch->getPosition() < POSITION_RESTING) ||
(ch->getPosition() > POSITION_STANDING)) {
if (!ch->canMeditate()) {
ch->stopTask();
return FALSE;
}
Expand Down Expand Up @@ -187,6 +186,10 @@ int task_yoginsa(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TOb
break;
case CMD_ABORT:
case CMD_STOP:
act("You stop meditating.", FALSE, ch, 0, 0, TO_CHAR);
act("$n stops meditating.", FALSE, ch, 0, 0, TO_ROOM);
ch->stopTask();
break;
case CMD_STAND:
act("You stop meditating and stand up.", FALSE, ch, 0, 0, TO_CHAR);
act("$n stops meditating and stands up.", FALSE, ch, 0, 0, TO_ROOM);
Expand Down
13 changes: 13 additions & 0 deletions code/code/misc/being.cc
Expand Up @@ -1774,3 +1774,16 @@ bool TBeing::applyTattoo(wearSlotT slot, const sstring & tat, silentTypeT silent
}
return FALSE;
}

bool TBeing::canMeditate()
{
if (isLinkdead() || (getPosition() < POSITION_RESTING))
return FALSE;

if (getPosition() > POSITION_STANDING &&
!(getPosition() == POSITION_MOUNTED &&
doesKnowSkill(SKILL_ADVANCED_RIDING) && (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doesKnowSkill looks redundant with getSkillValue. Is it possible to have skill value and still not know it?

return FALSE;
}
return TRUE;
}
2 changes: 2 additions & 0 deletions code/code/misc/being.h
Expand Up @@ -1917,4 +1917,6 @@ class TBeing : public TThing {
// used by doReset
bool resetPractices(classIndT resetClass, int &practices, bool reset = true);

bool canMeditate();

};
41 changes: 27 additions & 14 deletions code/code/misc/magic_skills.cc
Expand Up @@ -180,7 +180,7 @@ void TBeing::doPenance()
sendTo("You really don't know anything about repenting.\n\r");
return;
}
if (riding && dynamic_cast<TBeing *>(riding)) {
if ((riding && dynamic_cast<TBeing *>(riding)) && !(doesKnowSkill(SKILL_ADVANCED_RIDING) && (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))){
sendTo("It is impossible to be repentive while mounted!\n\r");
return;
}
Expand All @@ -197,9 +197,14 @@ void TBeing::doPenance()
if (task && getPosition() <= POSITION_SITTING)
stopTask();

sendTo("You rest and begin to chant.\n\r");
act("$n sits down in a position of penance.", TRUE, this, 0, 0, TO_ROOM);
setPosition(POSITION_RESTING);
if (!riding) {
sendTo("You rest and begin to chant.\n\r");
act("$n sits down in a position of penance.", TRUE, this, 0, 0, TO_ROOM);
setPosition(POSITION_RESTING);
} else {
sendTo("You begin to chant.\n\r");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move your mount while doing penance?

act("$n begins penance.", TRUE, this, 0, 0, TO_ROOM);
}
start_task(this, NULL, NULL, TASK_PENANCE, "", 0, in_room, 1, 0, 40);
}

Expand Down Expand Up @@ -231,7 +236,7 @@ void TBeing::doMeditate()
sendTo("You really don't know anything about meditating.\n\r");
return;
}
if (riding && dynamic_cast<TBeing *>(riding)) {
if ((riding && dynamic_cast<TBeing *>(riding)) && !(doesKnowSkill(SKILL_ADVANCED_RIDING) && (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))){
sendTo("It is impossible to meditate while mounted!\n\r");
return;
}
Expand All @@ -252,10 +257,14 @@ void TBeing::doMeditate()
} else if (getPosition() <= POSITION_SITTING)
stopTask();
}
sendTo("You rest and begin to meditate.\n\r");
act("$n sits down in a position of meditation.", TRUE, this, 0, 0, TO_ROOM);
setPosition(POSITION_SITTING);

if (!riding) {
sendTo("You rest and begin to meditate.\n\r");
act("$n sits down in a position of meditation.", TRUE, this, 0, 0, TO_ROOM);
setPosition(POSITION_RESTING);
} else {
sendTo("You begin to meditate.\n\r");
act("$n begins to meditate.", TRUE, this, 0, 0, TO_ROOM);
}
start_task(this, NULL, NULL, TASK_MEDITATE, "", 0, in_room, 1, 0, 40);
}

Expand All @@ -280,7 +289,7 @@ void TBeing::doYoginsa()
sendTo("You really don't know anything about meditating.\n\r");
return;
}
if (riding && dynamic_cast<TBeing *>(riding)) {
if ((riding && dynamic_cast<TBeing *>(riding)) && !(doesKnowSkill(SKILL_ADVANCED_RIDING) && (getSkillValue(SKILL_ADVANCED_RIDING) >= 50))){
sendTo("It is impossible to meditate while mounted!\n\r");
return;
}
Expand All @@ -301,10 +310,14 @@ void TBeing::doYoginsa()
} else if (getPosition() <= POSITION_SITTING)
stopTask();
}
sendTo("You relax and begin meditating.\n\r");
act("$n sits down and begins meditating.", TRUE, this, 0, 0, TO_ROOM);
setPosition(POSITION_SITTING);

if (!riding) {
sendTo("You rest and begin to meditate.\n\r");
act("$n sits down in a position of meditation.", TRUE, this, 0, 0, TO_ROOM);
setPosition(POSITION_RESTING);
} else {
sendTo("You begin to meditate.\n\r");
act("$n begins to meditate.", TRUE, this, 0, 0, TO_ROOM);
}
start_task(this, NULL, NULL, TASK_YOGINSA, "", 0, in_room, 1, 0, 40);
}

Expand Down
12 changes: 10 additions & 2 deletions code/code/task/task_meditate.cc
Expand Up @@ -14,8 +14,7 @@ int task_meditate(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TO
{
int learn, gainAmt = 0;

if (ch->isLinkdead() || (ch->getPosition() < POSITION_RESTING) ||
(ch->getPosition() > POSITION_STANDING)) {
if (!ch->canMeditate()) {
ch->stopTask();
return FALSE;
}
Expand Down Expand Up @@ -77,7 +76,16 @@ int task_meditate(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TO
break;
case CMD_ABORT:
case CMD_STOP:
act("You stop meditating.", FALSE, ch, 0, 0, TO_CHAR);
act("$n stops meditating.", FALSE, ch, 0, 0, TO_ROOM);
ch->stopTask();
break;
case CMD_STAND:
if (ch->getPosition() == POSITION_MOUNTED) {
act("Not while riding you don't!", FALSE, ch, 0, 0, TO_CHAR);
ch->stopTask();
break;
}
act("You stop meditating and stand up.", FALSE, ch, 0, 0, TO_CHAR);
act("$n stops meditating and stands up.", FALSE, ch, 0, 0, TO_ROOM);
ch->setPosition(POSITION_STANDING);
Expand Down
12 changes: 10 additions & 2 deletions code/code/task/task_penance.cc
Expand Up @@ -17,8 +17,7 @@ int task_penance(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TOb
double amt = 0.0;
double randomizer = 0.0;

if (ch->isLinkdead() || (ch->getPosition() < POSITION_RESTING) ||
(ch->getPosition() > POSITION_STANDING)) {
if (!ch->canMeditate()) {
ch->stopTask();
return FALSE;
}
Expand Down Expand Up @@ -96,7 +95,16 @@ int task_penance(TBeing *ch, cmdTypeT cmd, const char *, int pulse, TRoom *, TOb
break;
case CMD_ABORT:
case CMD_STOP:
act("You stop repenting.", FALSE, ch, 0, 0, TO_CHAR);
act("$n stops repenting.", FALSE, ch, 0, 0, TO_ROOM);
ch->stopTask();
break;
case CMD_STAND:
if (ch->getPosition() == POSITION_MOUNTED) {
act("Not while riding you don't!", FALSE, ch, 0, 0, TO_CHAR);
ch->stopTask();
break;
}
act("You stop repenting and stand up.", FALSE, ch, 0, 0, TO_CHAR);
act("$n stops repenting and stands up.", FALSE, ch, 0, 0, TO_ROOM);
ch->setPosition(POSITION_STANDING);
Expand Down
4 changes: 4 additions & 0 deletions lib/txt/news
@@ -1,3 +1,7 @@
06-20-19 : First bit of Deikhan rework. Those who are well learned in advanced
riding can now do new amazing feats. Super powererful things like
loot corpses and pen/yogi/med while on horseback.

02-16-19 : Immunity to +1/+2/+3 no longer have any effect in the game.
Immunity to non-magic is still circumvented by magic weapons. Also,
the enhance weapon spell no longer makes weapons glow.
Expand Down