Better superfetation implanted ova count sim
With this change simulation of superfetation ova release become more logical (IMHO). I don't like flat ova/4 count - it's to boring for me. :)
Now it's tied to fertility factors, pregAdaptation, and already implanted ova count. If mother have enough potential free space in womb it's allow full fertility force factors to be in use. If not - smaller and smaller ova count can be implanted, tied to potential free space. If ova count go above potential safe value, it's not guaratee to implant even single ova. But there is always a chance for implantation, and fertility factors still affect it. All calculation use birth size of fetus, not current size. So even if womb is crowded on early stage, it's still be processed as already crowded.
With these changes superfetation is not so deadly for natuaral mothers without fertiltiy drugs usage and without upgraded curvatives and surgery. But it's still allow player to overdo it relative easily. Further tweaking is possible but current state looked reasonable for me. It's not strictly artifical state(can be encountered in slaves naturally), so without artifical factors (fertility drugs etc) it's should have some natural safety mechanic. IMHO.
Also making this to force me add new function: FetusGetPrediction(actor, age). Function returns what volume (in cc) a single fetus of given actor will be, at given age of gestation (weeks). It's use current pregnancy profile, so automatically suport animals or other thing that change pregnancy profile for actor.
UPD: found that game code not really adapted to possibility of setPregType() returning 0. No errors, but some strange description on end week possible. Need some adaptation, or just changing if (ovum < 0) ovum=0;
to if (ovum < 1) ovum=1;
Resolving...
Merge request reports
Activity
added 1 commit
- c182a70c - fetus volume can't be exactly 0, or it's can cause 'divided by zero' error
381 vol = getVolByWeight(actor, age); 382 } else if (actor.pregData.sizeType === 2) { 383 vol = getVolByRaw(actor, age); 384 } 385 386 if (vol === 0) 387 vol = 0.1; 388 389 return vol; 390 391 function getCurData(actor, age) { 392 let i = 0; 393 let min, max, ageMin, ageMax, rateMin, rateMax, one, rateOne, rate, cage, csize; 394 let data = {}; 395 396 while (actor.pregData.fetusWeek[i + 1] < age && i < actor.pregData.fetusWeek.length - 1) { 379 vol = getVolByLen(actor, age); 380 } else if (actor.pregData.sizeType === 1) { 381 vol = getVolByWeight(actor, age); 382 } else if (actor.pregData.sizeType === 2) { 383 vol = getVolByRaw(actor, age); 384 } 385 386 if (vol === 0) 387 vol = 0.1; 388 389 return vol; 390 391 function getCurData(actor, age) { 392 let i = 0; 393 let min, max, ageMin, ageMax, rateMin, rateMax, one, rateOne, rate, cage, csize; 394 let data = {}; 419 420 return data; // csize * rate; 421 // maybe not very effective code, but simple and easy to debug. May be optimized more in future. 422 } 423 424 function getVolByLen(actor, age) { 425 let phi = 1.618; 426 let targetData, targetLen; 427 let volume = 0; 428 429 targetData = getCurData(actor, age); 430 targetLen = targetData.size * targetData.rate; 431 432 volume = ((4 / 3) * (Math.PI) * (phi / 2) * (Math.pow((targetLen / 2), 3))); 433 434 if (volume < 0) { // catch for strange cases, to avoid messing with outside code. This is direct copy from working code, with changes minimal to be enough. I will do not like to make it different from original with optimizing right now. It's can be second step, after mechanic is in place and working without bugs.
Edited by pregmodfanI'd default to at least 1 ova instead of 0 as you've noticed that everything is built around that being the only possibility.
I can get behind better implantation statistics rather than a flat 1/4. Though you have to keep in mind that hyperpreg off really does not want to go above 150kcc belly size.
added 1 commit
- eec63a5d - limit for in case that hyperpregnancy turned off
Ready to merge, I think.
There is still some strange descriptions for multiprenancy in slaveInteract screen (caused by .pregWeek resetting to 0 - with superfetation impregnation it's should be not), but it's not related to these changes and need separate refactoring.