Exemple #1
0
        internal virtual bool attemptKnockUp(double knockupChance, StandardSpawnType type)
        {
            if (knockupChance < 0 || type is null)
            {
                return(false);
            }
            else if (this.spawnType != null)
            {
                if (spawnType.HandleNewKnockupAttempt(type, out StandardSpawnType newType))
                {
                    var oldData = spawnType.AsReadOnlyData();
                    spawnType = newType;

                    source?.RaiseKnockupEvent(this, oldData);

                    return(true);
                }
                return(false);
            }
            else if (knockupChance > 1 || Utils.Rand(1000) <= Math.Round(knockupChance * 1000))
            {
                spawnType     = type;
                hoursTilBirth = type.hoursToBirth;

                source?.RaiseKnockupEvent(this);
                return(true);
            }
            return(false);
            //if pregnant: set spawnType and birthCountdown;
        }
Exemple #2
0
 internal void Reset(bool clearEggSize = false)
 {
     spawnType     = null;
     hoursTilBirth = 0;
     if (clearEggSize)
     {
         eggSize = null;
     }
 }
Exemple #3
0
 internal override bool attemptKnockUp(double knockupChance, StandardSpawnType type)
 {
     if (type is SpawnTypeIncludeAnal)
     {
         return(base.attemptKnockUp(knockupChance, type));
     }
     else
     {
         return(false);
     }
 }
Exemple #4
0
        protected DynamicTimeReaction DoBirth()
        {
            var output = HandleBirthing();

            spawnType     = null;         //clear pregnancy.
            hoursTilBirth = 0;

            diapauseHours  = 0;
            doDiapauseText = false;


            birthCount++;
            source?.RaiseBirthEvent(spawnType, this);
            return(output);
        }
Exemple #5
0
 //clears the current pregnancy.
 protected internal bool AbortPregnancy()
 {
     if (!isPregnant)
     {
         return(false);
     }
     else
     {
         spawnType      = null;
         hoursTilBirth  = 0;
         diapauseHours  = 0;
         doDiapauseText = false;
         source.RaiseKnockupEvent(this);
         return(true);
     }
 }
 protected internal StandardSpawnData(StandardSpawnType source) : base(source?.creatureID ?? throw new ArgumentNullException(nameof(source)))
 {
     fatherName   = source.father;
     this.spawnID = source.id;
 }