From 998210a530310f5de171c180b12dde89e9f01fd4 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sat, 3 Mar 2018 15:54:56 -0500 Subject: [PATCH] Fixed shoes showing up when they should not. Shoes and socks are described properly in footwear actions --- game.js | 37 ++++++++++++++++++++++++++++++++++++- recursive-desc.js | 34 +++++++++++++++++----------------- 2 files changed, 53 insertions(+), 18 deletions(-) diff --git a/game.js b/game.js index 6da1db2..9b2b908 100644 --- a/game.js +++ b/game.js @@ -113,8 +113,11 @@ let macro = return capital ? result.charAt(0).toUpperCase() + result.slice(1) : result; }, - "footDesc": function(plural=false,capital=false,possessive=true) { + "footDesc": function(plural=false,capital=false,possessive=false) { let result = ""; + if (!this.footWear) { + return this.footOnlyDesc(plural,capital); + } if (!this.footSockWorn && !this.footShoeWorn) { return this.footOnlyDesc(plural,capital); } else if (this.footShoeWorn) { @@ -167,6 +170,9 @@ let macro = "toeDesc": function(plural=false,capital=false,possessive=false) { let result = ""; + if (!this.footWear) { + return this.toeOnlyDesc(plural,capital); + } if (!this.footSockWorn && !this.footShoeWorn) { return this.toeOnlyDesc(plural,capital); } else if (this.footShoeWorn) { @@ -197,6 +203,35 @@ let macro = return capital ? result.charAt(0).toUpperCase() + result.slice(1) : result; }, + "shoeDesc": function(plural,capital) { + let result = ""; + switch(this.footShoe) { + case "shoe": + result = plural ? "shoes" : "shoe"; + break; + case "boot": + result = plural ? "boots" : "boot"; + break; + case "trainer": + result = plural ? "trainers" : "trainer"; + break; + case "sandal": + result = plural ? "sandals" : "sandal"; + break; + } + return capital ? result.charAt(0).toUpperCase() + result.slice(1) : result; + }, + + "sockDesc": function(plural,capital) { + let result = ""; + switch(this.footSock) { + case "sock": + result = plural ? "socks" : "sock"; + break; + } + return capital ? result.charAt(0).toUpperCase() + result.slice(1) : result; + }, + "jawType": "jaw", "jawDesc": function(plural=false,capital=false) { diff --git a/recursive-desc.js b/recursive-desc.js index ee43b3a..1261869 100644 --- a/recursive-desc.js +++ b/recursive-desc.js @@ -137,7 +137,7 @@ function defaultStomp(container, macro, verbose) { if (container.count == 0) return "Your " + macro.footDesc() + " thumps the ground."; else if (isFatal(macro)) - return "You crush " + container.describe(verbose) + " under" + macro.footDesc() + "."; + return "You crush " + container.describe(verbose) + " under" + macro.footDesc(false,false,true) + "."; else return "You step on " + container.describe(verbose) + "."; } @@ -525,65 +525,65 @@ function defaultSoulDigest(container, macro, verbose) { function defaultWearShoe(container, macro, verbose) { if (container.count == 0) { - return "You slip on your shoes."; + return "You slip on your " + macro.shoeDesc(true,false) + "."; } else { - return "You slip on your shoes, " + macro.toeDesc(true) + " wriggling against " + container.describe(false) + " trapped within!"; + return "You slip on your " + macro.shoeDesc(true,false) + ", " + macro.toeDesc(true) + " wriggling against " + container.describe(false) + " trapped within!"; } } function defaultRemoveShoe(container, macro, verbose) { if (container.count == 0) { - return "You pull off your shoes."; + return "You pull off your " + macro.shoeDesc(true,false) + "."; } else { - return "You pull off your shoes, " + macro.toeDesc(true) + " rubbing against " + container.describe(false) + " on the way out."; + return "You pull off your " + macro.shoeDesc(true,false) + ", " + macro.toeDesc(true) + " rubbing against " + container.describe(false) + " on the way out."; } } function defaultWearSock(container, macro, verbose) { if (container.count == 0) { - return "You slip on your socks."; + return "You slip on your " + macro.sockDesc(true,false) + "."; } else { - return "You slip on your socks, " + macro.toeDesc(true) + " grinding against " + container.describe(false) + " trapped in the cotton tube!"; + return "You slip on your " + macro.sockDesc(true,false) + ", " + macro.toeDesc(true) + " grinding against " + container.describe(false) + " trapped in the cotton tube!"; } } function defaultRemoveSock(container, macro, verbose) { if (container.count == 0) { - return "You pull off your socks. Cool air washes over your " + macro.toeOnlyDesc(true); + return "You pull off your " + macro.sockDesc(true,false) + ". Cool air washes over your " + macro.toeOnlyDesc(true); } else { - return "You pull off your socks, leaving " + container.describe(false) + " trapped at the bottom."; + return "You pull off your " + macro.sockDesc(true,false) + ", leaving " + container.describe(false) + " trapped at the bottom."; } } function defaultStuffShoe(container, macro, verbose) { if (container.count == 0) { - return "You don't have anything to stuff into your shoes."; + return "You don't have anything to stuff into your " + macro.shoeDesc(true) + "."; } else { - return "You grab " + container.describe(verbose) + " and stuff " + (container.count > 1 ? "them" : "it") + " into your shoe!"; + return "You grab " + container.describe(verbose) + " and stuff " + (container.count > 1 ? "them" : "it") + " into your " + macro.shoeDesc() + "!"; } } function defaultStuffSock(container, macro, verbose) { if (container.count == 0) { - return "You don't have anything to stuff into your socks."; + return "You don't have anything to stuff into your " + macro.sockDesc(true) + "."; } else { - return "You grab " + container.describe(verbose) + " and stuff " + (container.count > 1 ? "them" : "it") + " into your sock!"; + return "You grab " + container.describe(verbose) + " and stuff " + (container.count > 1 ? "them" : "it") + " into your " + macro.sockDesc() + "!"; } } function defaultDumpShoe(container, macro, verbose) { if (container.count == 0) { - return "Your shoes are empty, silly."; + return "Your " + macro.shoeDesc(true) + " are empty, silly."; } else { - return "You shake out your shoes, dumping " + container.describe(false) + " onto the ground."; + return "You shake out your " + macro.shoeDesc(true) + ", dumping " + container.describe(false) + " onto the ground."; } } function defaultDumpSock(container, macro, verbose) { if (container.count == 0) { - return "You don't have anything to stuff into your socks."; + return "You don't have anything to stuff into your " + macro.sockDesc(true) + "."; } else { - return "You turn your socks inside-out, dumping " + container.describe(false) + " onto the ground."; + return "You turn your " + macro.shoeDesc(true) + " inside-out, dumping " + container.describe(false) + " onto the ground."; } }