Skip to content

Commit

Permalink
Added new Attribute, 'scanned', which is given to the elevatorDoor on…
Browse files Browse the repository at this point in the history
…ce player successfully scans fob; Added new check to 'Go' routine in Tutorial and 'ScanSub' routine to check if the elevatorDoor has scanned attribute (if it's already been scanned). If so, a message is printed telling the player that the fob has been scanned, and that they may proceed; Added tests to ensure scanning fob thrice produces said message, and tests to ensure the player is not stuck in the elevator once scanning thrice.
  • Loading branch information
libraun committed Sep 24, 2024
1 parent 601b9c1 commit 6f5bd0f
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 5 deletions.
29 changes: 24 additions & 5 deletions untitledHeistGame.inf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Include "help.h";

Attribute hint_given;

Attribute scanned;

Attribute heavy;
Attribute bulky;

Expand Down Expand Up @@ -207,19 +209,31 @@ with
'security' 'scanner' [;
Examine: "The scanner's lights blink expectantly for your security fob. Good job! Now this appears to be an object that you can interact with, requesting this security fob. If you type I or INVENTORY it will display the items you are currently carrying! There is no limit on the number of items you may hold, but some items are heavy or bulky which means you can only carry one of them. Try opening your inventory and looking at the security fob.";
Receive:
if(noun==securityCard && securityCard hasnt heavy){
print "You insert the fob into the scanner. The green lights happily flash a few times, and the door opens! You have completed the tutorial. To enter the game proper type ~north~ or ~n~. If you ever need help try the commands help or intro!";
give elevatorDoor open;
give elevatorDoor ~locked;
return true;

if(noun==securityCard &&
securityCard hasnt heavy &&
elevatorDoor has scanned) {

print "You've already scanned your fob. Enter 'n' to proceed!";
}

if(noun==securityCard && securityCard has heavy){
print "Oops, you fumble the fob and drop it on the floor of the elevator! Use ~take [object]~ to pick up an object. Try grabbing the fob and try again!";
give securityCard ~heavy;
move securityCard to Tutorial;
return true;
}
if(noun==securityCard
&& securityCard hasnt heavy){

print "You insert the fob into the scanner. The green lights happily flash a few times, and the door opens! You have completed the tutorial. To enter the game proper type ~north~ or ~n~. If you ever need help try the commands help or intro!";

give elevatorDoor open;
give elevatorDoor ~locked;

give elevatorDoor scanned;
return true;
}
],
before [;
Go:
Expand Down Expand Up @@ -274,6 +288,10 @@ has heavy;
print "You see nothing to scan...";
return false;
}
if(noun==securityCard && securityCard hasnt heavy && elevatorDoor has scanned) {

print "You've already scanned your fob. Enter 'n' to proceed!";
}

! (Almost) Same action as 'Receive' in Tutorial
if (noun == securityCard && securityCard hasnt heavy) {
Expand All @@ -284,6 +302,7 @@ has heavy;
print "(first taking the Security Key Fob)";
new_line;
}
give elevatorDoor scanned;
"You insert the fob into the scanner. The green lights happily flash a few times, and the door opens! You have completed the tutorial. To enter the game proper type ~north~ or ~n~. If you ever need help try the commands help or intro!";
give elevatorDoor open;
give elevatorDoor ~locked;
Expand Down
46 changes: 46 additions & 0 deletions untitledHeistGame.test
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,52 @@ You insert the fob into the scanner.
(first taking the Security Key Fob)
You insert the fob into the scanner.



* scan fob thrice
> scan fob
> scan fob
(first taking the Security Key Fob)
You insert the fob into the scanner.
> scan fob
You've already scanned your fob.
> n
> The Lobby

* scan id thrice

> scan id
> scan id
(first taking the Security Key Fob)
You insert the fob into the scanner.
> scan id
You've already scanned your fob.
> n
> The Lobby

* show id to scanner thrice

> show id to scanner
> show id to scanner
(first taking the Security Key Fob)
You insert the fob into the scanner.
> show id to scanner
You've already scanned your fob.
> n
The Lobby

* insert card into scanner twice

> insert card into scanner
> insert card into scanner
(first taking the Security Key Fob)
You insert the fob into the scanner.
> insert card into scanner
You've already scanned your fob.
> n
The Lobby


* insert card (fob) into scanner in Tutorial
> insert card into scanner
> take card
Expand Down

0 comments on commit 6f5bd0f

Please sign in to comment.