Skip to content
New issue

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

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

Already on GitHub? # to your account

Going to $HOME with --force flag doesn't reset character stats or apply ring/status effects #123

Closed
zoomiti opened this issue Sep 9, 2021 · 7 comments · Fixed by #128
Closed

Comments

@zoomiti
Copy link
Contributor

zoomiti commented Sep 9, 2021

These are the commands I type into the command line to try to go home to reset my characters HP but it never happens

[zoomiti@MastermindRogue ~]$ rpg-cli pwd
/home/zoomiti
[zoomiti@MastermindRogue ~]$ rpg-cli stat
    mage[1]@home
    hp:[xxxxx-----] 14/28
    mp:[xxx-------] 3/12
    xp:[xxxxxx----] 17/30
    att:3   mag:33   def:0   spd:11
    equip:{}
    item:{}
    46g
[zoomiti@MastermindRogue ~]$ rpg-cli cd ~
[zoomiti@MastermindRogue ~]$

For the record I am on 1.0.0

[zoomiti@MastermindRogue ~]$ rpg-cli -V
rpg-cli 1.0.0
@facundoolano
Copy link
Owner

Hi @zoomiti . What's your system and what's the value of the $HOME environment variable?

@zoomiti
Copy link
Contributor Author

zoomiti commented Sep 9, 2021

Hi @facundoolano I double checked and it was /home/zoomiti

@facundoolano
Copy link
Owner

facundoolano commented Sep 9, 2021

I see. What happens if you rpg cd /home/ && rpg cd ~? (this is: move out of home and then come back)

@zoomiti
Copy link
Contributor Author

zoomiti commented Sep 11, 2021

That works actually, I suspect it has to do with the way I set up my bashrc. Because I force the cd (I don't like having to traverse a directory at a time/have to change the cd path due to the new context.) I think rpg cd -f ~ doesn't reset your character the same way it doesn't start battles.

$ cat ~/.bashrc
...
cd () {
    builtin cd "$@"
    rpg-cli cd -f .
    rpg-cli battle
}
...

@zoomiti
Copy link
Contributor Author

zoomiti commented Sep 11, 2021

$ rpg cd /home/ && rpg cd  -f ~
$ rpg cd /home/ && rpg cd  ~
    mage[1][xxxx][xxxx][xx--]@home +3hp +3mp
$

It seems like I am right, not sure if this is intended or if I should just circumvent it with a check for going home so that I don't force cd'ing into the home directory...

@zoomiti
Copy link
Contributor Author

zoomiti commented Sep 11, 2021

I figured out a work around that seems to work for now in case this is intended behavior.

cd () {
     builtin cd "$@"
     if [[ $PWD== ~ ]] ; then
         rpg-cli cd ~
     else
         rpg-cli cd -f .
         rpg-cli battle
     fi
 }

@facundoolano
Copy link
Owner

facundoolano commented Sep 12, 2021

Right, that's is how --force option works: it just overrides the current location/directory, but doesn't apply the side-effects of visiting that directory. This made sense back when I first implemented it, but I'm now considering that the most consistent behavior would be to actually apply side effects (both resetting of char stats in home and applying status/ring effects such as poison damage).

@zoomiti zoomiti changed the title Going to $HOME No longer resets my characters hp Going to $HOME with --force flag doesn't reset character stats or apply ring/status effects Sep 13, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants