So I'm homebrewing a creature that has the ability to summon things that buff its attacks and gives it resistances/immunities. The stat block is shown below.
Huge monstrosity, unaligned
Armor Class 17 (Natural Armor)
Hit Points 261 (18d12 + 144)
Speed 15 ft.
STR 24 (+7) DEX 10 (+0) CON 26 (+8) INT 3 (-4) WIS 10 (+0) CHA 7 (-2)
Saving Throws STR +14, CON +15
Skills Intimidation +17, Perception +14
Damage Immunities Poison
Condition Immunities Blinded, Deafened, Frightened, Poisoned
Senses Darkvision 60ft., Passive Perception 14
Estimated CR 24
Fungal Body. The toadstool can’t be blinded, deafened, frightened, or poisoned, and any critical hit against it counts as a normal hit, unless it is incapacitated.
Buff. The toadstool becomes more powerful depending on the number of sporecaps summoned, as seen below.
1-4: The toadstool deals an extra 1d10 poison damage on all attacks, it can release an extra boomshroom.
5-7: The toadstool deals an extra 2d10 poison damage on attacks, it gains resistance to all damage from piercing, slashing, & bludgeoning damage from nonmagical attacks, and it can release an extra 2 boomshrooms.
8+: The toadstool deals an extra 3d10 poison damage on attacks, it gains immunity to all damage from piercing, slashing, & bludgeoning damage from nonmagical attacks, resistance to all damage from piercing, slashing, & bludgeoning damage from magical attacks, and it can release an extra 3 boomshrooms.
Multiattack. The toadstool makes two attacks, one with its bite and one other action.
Bite. Melee Weapon Attack: +7 to hit, reach 5 ft., 1 target. Hit: 23 (3d10+ 7) piercing damage.
Sporecap.(Recharge 4-6) The toadstool summons 1d4 sporecaps, which are large, tree-size mushrooms. The sporecaps buff the toadstool. The number of sporecaps determines how powerful the toadstool is. These sporecaps have 5 (1d10) hit points each.
Boomshroom. The toadstool releases 4 (1d8) Boomshrooms. Boomshrooms are small mushrooms that grow and explode, and any creature within 5 feet of it takes 12(2d12) poison damage.
Spore Bomb. The toadstool attaches a spore to a creature of its choice within 20 feet of it. This spore explodes at the end of the target's next turn, creating a 5-ft square of poisonous gas for 1 minute. Anyone who enters the space of the cloud takes 13 (3d8) poison damage for each round they spend their turn inside the gas.
Ground Pound. When at 40% of it's max HP or less, the toadstool can hop on the ground, and any creature within 25 feet of it must succeed on a DC 15 Dexterity saving throw, taking 27(3d12+7) bludgeoning damage on a failed save, or half as much on a successful one.
How would the buff ability effect challenge rating?