@@ -373,6 +373,7 @@ private void IterateOverAnimals()
373373
374374 foreach ( FarmAnimal animal in this . GetAnimals ( ) )
375375 {
376+ Random random = Utility . CreateRandom ( animal . myID . Value / 2.0 , Game1 . stats . DaysPlayed ) ;
376377 try
377378 {
378379 if ( ! animal . wasPet . Value && this . PettingEnabled )
@@ -425,18 +426,22 @@ private void IterateOverAnimals()
425426 {
426427 if ( this . TakeTrufflesFromPigs && this . isFirstTimeTruffle )
427428 {
428- Object toAdd = new Object ( animal . currentProduce . Value , 1 , false , - 1 , animal . produceQuality . Value ) ;
429+ int stack = random . NextDouble ( ) + Game1 . player . team . AverageDailyLuck ( ) * animal . GetAnimalData ( ) . DeluxeProduceLuckMultiplier < 0.7 ? 1 : 2 ;
430+ Object toAdd = new Object ( animal . currentProduce . Value , stack , false , - 1 , animal . produceQuality . Value ) ;
429431 this . AddItemToInventory ( toAdd , farmer ) ;
430432
431433 stats . TrufflesHarvested ++ ;
432434 }
433435 }
434436 else
435437 {
436- Object toAdd = new Object ( animal . currentProduce . Value , 1 , false , - 1 , animal . produceQuality . Value ) ;
438+ int stack = random . NextDouble ( ) + Game1 . player . team . AverageDailyLuck ( ) * animal . GetAnimalData ( ) . DeluxeProduceLuckMultiplier < 0.7 ? 1 : 2 ;
439+ stack = animal . hasEatenAnimalCracker . Value ? stack * 2 : stack ;
440+
441+ Object toAdd = new Object ( animal . currentProduce . Value , stack , false , - 1 , animal . produceQuality . Value ) ;
437442 this . AddItemToInventory ( toAdd , farmer ) ;
443+ animal . currentProduce . Value = null ;
438444
439- animal . currentProduce . Value = "0" ;
440445 stats . ProductsHarvested ++ ;
441446 }
442447
@@ -656,18 +661,15 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
656661 if ( Game1 . player . isMarriedOrRoommates ( ) )
657662 {
658663 string spouse = Game1 . player . isMarriedOrRoommates ( ) ? Game1 . player . getSpouse ( ) . getName ( ) : this . Checker ;
659- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(1, "Xdialog"), stats, this.Config);
660664 message += I18n . Dialog_Xdialog1 ( spouse : spouse ) ;
661665 }
662666 else
663667 {
664- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(2, "Xdialog"), stats, this.Config);
665668 message += I18n . Dialog_Xdialog2 ( num_actions : stats . NumActions ) ;
666669 }
667670
668671 if ( totalCost > 0 && this . CostPerAnimal > 0 )
669672 {
670- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(3, "Xdialog"), stats, this.Config);
671673 message += I18n . Dialog_Xdialog3 ( total_cost : stats . TotalCost ) ;
672674 }
673675
@@ -676,12 +678,10 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
676678 }
677679 else if ( gatheringOnly )
678680 {
679- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(4, "Xdialog"), stats, this.Config);
680681 message += I18n . Dialog_Xdialog4 ( checker : this . Checker ) ;
681682
682683 if ( totalCost > 0 && this . CostPerAnimal > 0 )
683684 {
684- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(3, "Xdialog"), stats, this.Config);
685685 message += I18n . Dialog_Xdialog3 ( total_cost : stats . TotalCost ) ;
686686 }
687687
@@ -693,7 +693,7 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
693693 NPC character = Game1 . getCharacterFromName ( this . Checker ) ;
694694 if ( character != null )
695695 {
696- //this.isCheckerCharacter = true;
696+ // this.isCheckerCharacter = true;
697697 // string portrait = "";
698698 if ( character . Name . Equals ( "Shane" ) )
699699 {
@@ -727,8 +727,6 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
727727 }
728728 else
729729 {
730- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("greeting"), stats, this.Config);
731- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(5, "Xdialog"), stats, this.Config);
732730 message += this . GetRandomMessage ( messageStoreName : "greeting" , low : 1 , high : 7 ) ;
733731 message += I18n . Dialog_Xdialog5 ( ) ;
734732 }
@@ -738,12 +736,10 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
738736 {
739737 if ( doesPlayerHaveEnoughCash )
740738 {
741- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(6, "Xdialog"), stats, this.Config);
742739 message += I18n . Dialog_Xdialog6 ( total_cost : stats . TotalCost ) ;
743740 }
744741 else
745742 {
746- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("unfinishedmoney"), stats, this.Config);
747743 message += this . GetRandomMessage ( messageStoreName : "unfinishedmoney" , low : 1 , high : 8 ) ;
748744 }
749745 }
@@ -753,7 +749,6 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
753749 //message += portrait + "#$e#";
754750 }
755751
756- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetRandomMessage("smalltalk"), stats, this.Config);
757752 message += this . GetRandomMessage ( messageStoreName : "smalltalk" , low : 1 , high : 14 ) ;
758753 // message += portrait + "#$e#";
759754
@@ -762,8 +757,6 @@ private void ShowMessage(int numActions, int totalCost, bool doesPlayerHaveEnoug
762757 }
763758 else
764759 {
765- //message += checker + " has performed " + numActions + " for your animals.";
766- // message += this.DialogueManager.PerformReplacement(this.DialogueManager.GetMessageAt(7, "Xdialog"), stats, this.Config);
767760 message += I18n . Dialog_Xdialog7 ( checker : this . Checker , num_actions : stats . NumActions ) ;
768761 HUDMessage msg = new HUDMessage ( message ) ;
769762 Game1 . addHUDMessage ( msg ) ;
0 commit comments