MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / throwChocolateBar

Method throwChocolateBar

code/main/WishingWell.ts:288–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

286 }
287
288 private throwChocolateBar(): void{
289 if(this.getGame().getChocolateBars().getCurrent() >= 1){
290 // Pay the price
291 this.getGame().getChocolateBars().add(-1);
292 // Set the speech (depending on if it's the first bar we throw or not)
293 if(Saving.loadNumber("wishingWellHowManyChocolateBarsThrown") == 0)
294 this.currentSpeech = "wishingWellChocolateBarIntroductionSpeech";
295 else
296 this.currentSpeech = "wishingWellThrewChocolateBarSpeech";
297 // Increase the number of chocolate bars thrown
298 Saving.saveNumber("wishingWellHowManyChocolateBarsThrown", Saving.loadNumber("wishingWellHowManyChocolateBarsThrown") + 1)
299 // We are now enchanting
300 Saving.saveBool("wishingWellWeAreEnchanting", true);
301 // Update
302 this.update();
303 this.getGame().updatePlace();
304 }
305 }
306
307 private throwFirstCandy(): void{
308 if(this.getGame().getCandies().getCurrent() >= 1){

Callers

nothing calls this directly

Calls 6

updateMethod · 0.95
getCurrentMethod · 0.80
getChocolateBarsMethod · 0.80
updatePlaceMethod · 0.80
addMethod · 0.65
getGameMethod · 0.45

Tested by

no test coverage detected