+def cloak():
+ "Change cloaking-device status."
+ if game.ship == 'F':
+ prout(_("Ye Faerie Queene hath no cloaking device."))
+ return
+
+ key = scanner.nexttok()
+
+ if key == "IHREAL":
+ huh()
+ return
+
+ action = None
+ if key == "IHALPHA":
+ if scanner.sees("on"):
+ if game.iscloaked:
+ prout(_("The cloaking device has already been switched on."))
+ return
+ action = "CLON"
+ elif scanner.sees("off"):
+ if not game.iscloaked:
+ prout(_("The cloaking device has already been switched off."))
+ return
+ action = "CLOFF"
+ else:
+ huh()
+ return
+ else:
+ if not game.iscloaked:
+ proutn(_("Switch cloaking device on? "))
+ if not ja():
+ return
+ action = "CLON"
+ else:
+ proutn(_("Switch cloaking device off? "))
+ if not ja():
+ return
+ action = "CLOFF"
+ if action is None:
+ return
+
+ if action == "CLOFF":
+ if game.irhere and game.state.date >= ALGERON and not game.isviolreported:
+ prout(_("Spock- \"Captain, the Treaty of Algeron is in effect.\n Are you sure this is wise?\""))
+ if not ja():
+ return
+ prout("Engineer Scott- \"Aye, Sir.\"")
+ game.iscloaked = False
+ if game.irhere and game.state.date >= ALGERON and not game.isviolreported:
+ prout(_("The Romulan ship discovers you are breaking the Treaty of Algeron!"))
+ game.ncviol += 1
+ game.isviolreported = True
+
+ #if (neutz and game.state.date >= ALGERON) finish(FCLOAK);
+ return
+
+ if action == "CLON":
+ if damaged(DCLOAK):
+ prout(_("Engineer Scott- \"The cloaking device is damaged, Sir.\""))
+ return
+
+ if game.condition == "docked":
+ prout(_("You cannot cloak while docked."))
+
+ if game.state.date >= ALGERON and not game.isviolreported:
+ prout(_("Spock- \"Captain, using the cloaking device is a violation"))
+ prout(_(" of the Treaty of Algeron. Considering the alternatives,"))
+ proutn(_(" are you sure this is wise? "))
+ if not ja():
+ return
+ prout(_("Engineer Scott- \"Cloaking device has engaging, Sir...\""))
+ attack(True)
+ prout(_("Engineer Scott- \"Cloaking device has engaged, Sir.\""))
+ game.iscloaked = True
+
+ if game.irhere and game.state.date >= ALGERON and not game.isviolreported:
+ prout(_("The Romulan ship discovers you are breaking the Treaty of Algeron!"))
+ game.ncviol += 1
+ game.isviolreported = True
+