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

Method putIntoBottles

code/main/Cauldron.ts:379–499  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

377 }
378
379 private putIntoBottles(): void{
380 // Reset the potions comment
381 this.potionsComment = null;
382
383 // Stop any action
384 this.changeAction(CauldronAction.NOTHING);
385
386 // Take the candies & lollipops in the cauldron
387 this.getGame().getCandiesInCauldron().add(-this.getGame().getCandiesInCauldron().getCurrent());
388 this.getGame().getLollipopsInCauldron().add(-this.getGame().getLollipopsInCauldron().getCurrent());
389
390 // Health potion check
391 if(this.actionLog[0] != null && // There's a last action
392 this.actionLog[0].getAction() == CauldronAction.MIXING && // It was mixing
393 this.actionLog[0].getLollipops() == 0 && // We didn't use any lollipop
394 this.actionLog[0].getCandies() > 0 && // We used at least one candy
395 this.actionLog[0].getCandies() % 100 == 0 && // We used a multiple of 100 candies
396 this.actionLog[0].getTime() < 30){ // We mixed for less than 30 seconds
397 this.makePotions("questPlayerSpellHealthPotionHasSpell", "questPlayerSpellHealthPotionQuantity", this.actionLog[0].getCandies()/100, "health potion", "health potions");
398 }
399
400 // Turtle potion check
401 else if(this.actionLog[1] != null && // There's a last last action
402 this.actionLog[1].getAction() == CauldronAction.MIXING && // It was mixing
403 this.actionLog[1].getCandies() > 0 && // We used at least one candy
404 this.actionLog[1].getLollipops() > 0 && // We used at least one lollipop
405 this.actionLog[1].getCandies() % 50 == 0 && // We used a multiple of 50 candies
406 this.actionLog[1].getLollipops() % 500 == 0 && // We used a multiple of 500 lollipops
407 this.actionLog[1].getLollipops() == 10 * this.actionLog[1].getCandies() && // We used 10 times more lollipops than candies
408 this.actionLog[1].getTime() > 6 && // We mixed for more than 6 seconds
409 this.actionLog[1].getTime() < 14 && // We mixed for less than 14 seconds
410 this.actionLog[0] != null && // There's a last action
411 this.actionLog[0].getAction() == CauldronAction.MIXING && // It was mixing
412 this.actionLog[0].getCandies() == 2 * this.actionLog[1].getCandies() && // We used twice more candies than in the previous action
413 this.actionLog[0].getLollipops() == this.actionLog[1].getLollipops()){ // We used as many lollipops as in the previous action
414 this.makePotions("questPlayerSpellTurtlePotionHasSpell", "questPlayerSpellTurtlePotionQuantity", this.actionLog[0].getLollipops()/500, "turtle potion", "turtle potions");
415 }
416
417 // Anti-gravity potion check
418 else if(this.actionLog[1] != null && // There's a last last action
419 this.actionLog[1].getAction() == CauldronAction.BOILING && // It was boiling
420 this.actionLog[1].getLollipops() == 0 && // We didn't use any lollipop
421 this.actionLog[1].getCandies() > 0 && // We used at least one candy
422 this.actionLog[1].getCandies() % 1000 == 0 && // We used a multiple of 1000 candies
423 this.actionLog[1].getTime() >= 3 && this.actionLog[1].getTime() < 6 && // The water was lukewarm when we stopped boiling
424 this.actionLog[0] != null && // There's a last action
425 this.actionLog[0].getAction() == CauldronAction.BOILING && // It was boiling
426 this.actionLog[0].getLollipops() == 0 && // There were still no lollipops
427 this.actionLog[0].getCandies() == 2 * this.actionLog[1].getCandies() && // There were twice more candies than in the previous action
428 this.actionLog[0].getTime() > 17){ // The water was boiling when we stopped boiling
429 this.makePotions("questPlayerSpellAntiGravityPotionHasSpell", "questPlayerSpellAntiGravityPotionQuantity", this.actionLog[1].getCandies()/200, "anti-gravity potion", "anti-gravity potions");
430 }
431
432 // Berserk & cloning potion check
433 else if(this.actionLog[0] != null && // There's a last action
434 this.actionLog[0].getAction() == CauldronAction.MIXING && // It was mixing
435 this.actionLog[0].getLollipops() > 0 && // We used at least one lollipop
436 this.actionLog[0].getLollipops() % 20000 == 0 && // We used a multiple of 20000 lollipops

Callers

nothing calls this directly

Calls 13

changeActionMethod · 0.95
makePotionsMethod · 0.95
updateMethod · 0.95
getCandiesInCauldronMethod · 0.80
getCurrentMethod · 0.80
getActionMethod · 0.80
getTimeMethod · 0.80
updatePlaceMethod · 0.80
addMethod · 0.65
getGameMethod · 0.45
getLollipopsMethod · 0.45

Tested by

no test coverage detected