@@ -537,7 +537,7 @@ func (rb *RainBackground) gardenSeedsInFlight() int {
537537// the global flying-seed ceiling so young plants see few sky seeds, and mature
538538// meadows can carry more falling seeds.
539539func (rb * RainBackground ) gardenSeedThrottleRelief () float64 {
540- if rb . GardenPlots == nil || len (rb .GardenPlots ) == 0 {
540+ if len (rb .GardenPlots ) == 0 {
541541 return 0
542542 }
543543 var sum float64
@@ -595,14 +595,14 @@ func (rb *RainBackground) gardenMaxFlyingSkySeeds(relief float64) int {
595595 if reliefEff > 1 {
596596 reliefEff = 1
597597 }
598- cap := int (0.5 + float64 (lo )+ (float64 (hi - lo ))* reliefEff )
599- if cap < 1 {
600- cap = 1
598+ ceiling := int (0.5 + float64 (lo )+ (float64 (hi - lo ))* reliefEff )
599+ if ceiling < 1 {
600+ ceiling = 1
601601 }
602- if cap > hi {
603- cap = hi
602+ if ceiling > hi {
603+ ceiling = hi
604604 }
605- return cap
605+ return ceiling
606606}
607607
608608// gardenSkySeedsForBatch returns how many of 'need' new sky drops should be
@@ -727,7 +727,7 @@ func (rb *RainBackground) Update() {
727727 rb .Flowers [p .X ].drops ++
728728 }
729729
730- if rb .Mode == config .UIRainAnimationGarden && p .Y >= maxDropY && rb .GardenPlots != nil && p .X >= 0 && p .X < len (rb .GardenPlots ) {
730+ if rb .Mode == config .UIRainAnimationGarden && p .Y >= maxDropY && p . Y < rb . Height && rb .GardenPlots != nil && p .X >= 0 && p .X < len (rb .GardenPlots ) {
731731 g := & rb .GardenPlots [p .X ]
732732 if p .IsSeed {
733733 if g .stage == gardenStageNone {
@@ -749,6 +749,7 @@ func (rb *RainBackground) Update() {
749749 rb .gardenWaterPlot (g )
750750 }
751751 }
752+ p .Age = p .MaxAge
752753 }
753754 }
754755
@@ -762,7 +763,7 @@ func (rb *RainBackground) Update() {
762763 rb .Drops = alive
763764
764765 // Spawn new drops to maintain count
765- if rb .Width > 0 && rb .Height > 0 && ! (rb .Mode == config .UIRainAnimationGarden && rb .GardenSunny ) {
766+ if rb .Width > 0 && rb .Height > 0 && (rb .Mode != config .UIRainAnimationGarden || ! rb .GardenSunny ) {
766767 targetCount := rb .Width * 2
767768 if rb .Mode == config .UIRainAnimationGarden {
768769 rb .spawnGardenMaintainingDrops (minY , targetCount )
@@ -812,9 +813,10 @@ func (rb *RainBackground) Render() string {
812813 }
813814 }
814815
815- if rb .Mode == config .UIRainAnimationGarden {
816+ switch rb .Mode {
817+ case config .UIRainAnimationGarden :
816818 rb .paintGardenOverlays (cells )
817- } else if rb . Mode == config .UIRainAnimationAdvanced {
819+ case config .UIRainAnimationAdvanced :
818820 // Top row: clouds
819821 if len (rb .CloudRow ) >= rb .Width {
820822 cloudStyle := lipgloss .NewStyle ().Foreground (activeProfile ().cloudColor )
@@ -833,9 +835,7 @@ func (rb *RainBackground) Render() string {
833835 }
834836 }
835837 }
836- }
837-
838- if rb .Mode == config .UIRainAnimationMatrix {
838+ case config .UIRainAnimationMatrix :
839839 subY := matrixSubliminalBackgroundRow (rb .Height )
840840 if subY >= 0 && subY < rb .Height && len (styles ) > 0 {
841841 dim := lipgloss .NewStyle ().
@@ -1159,22 +1159,31 @@ func (rb *RainBackground) paintGardenOverlays(cells []string) {
11591159 case gardenStageWither :
11601160 st = witherStyle
11611161 case gardenStageEternal :
1162- switch {
1163- case k == 0 :
1162+ switch k {
1163+ case 0 :
11641164 st = stemStyle
1165- case k == h - 1 :
1165+ case h - 1 :
11661166 st = gardenFlowerStyle (g .flowerTint ).Bold (true )
11671167 default :
11681168 st = leafStyle
11691169 }
11701170 default :
1171- switch {
1172- case g .stage == gardenStagePlanted && k == 0 :
1173- st = lipgloss .NewStyle ().Foreground (lipgloss .Color ("#5D4037" ))
1174- case k == 0 && g .stage >= gardenStageBud :
1175- st = stemStyle
1176- case k >= h - 1 && g .stage >= gardenStageBud :
1177- st = gardenFlowerStyle (g .flowerTint )
1171+ switch k {
1172+ case 0 :
1173+ switch {
1174+ case g .stage == gardenStagePlanted :
1175+ st = lipgloss .NewStyle ().Foreground (lipgloss .Color ("#5D4037" ))
1176+ case g .stage >= gardenStageBud :
1177+ st = stemStyle
1178+ default :
1179+ st = leafStyle
1180+ }
1181+ case h - 1 :
1182+ if g .stage >= gardenStageBud {
1183+ st = gardenFlowerStyle (g .flowerTint )
1184+ } else {
1185+ st = leafStyle
1186+ }
11781187 default :
11791188 st = leafStyle
11801189 }
0 commit comments