コード例 #1
0
ファイル: Person.cs プロジェクト: simon217/ZhongHuaSanGuoZhi
        private void huaiyunshijian()
        {
            if (this.huaiyun)
            {
                this.huaiyuntianshu++;
                //if (this.huaiyuntianshu == 30)
                if (GameObject.Chance((this.huaiyuntianshu - 20) * 5) && !this.faxianhuaiyun)
                {
                    ExtensionInterface.call("FoundPregnant", new Object[] { this.Scenario, this });
                    this.faxianhuaiyun = true;
                    if (this.BelongedFaction != null && this == this.BelongedFaction.Leader)  //女君主自己怀孕
                    {
                    }
                    else
                    {
                        this.Scenario.GameScreen.faxianhuaiyun(this);
                    }
                }
                else if (GameObject.Chance((this.huaiyuntianshu - 290) * 5))
                {
                    Person haizifuqin = new Person();
                    Person haizi = new Person();
                    this.huaiyun = false;
                    this.faxianhuaiyun = false;
                    this.huaiyuntianshu = -1;

                    if (this.suoshurenwu == -1)
                    {
                        this.suoshurenwu = this.LocationArchitecture.BelongedFaction.LeaderID;
                    }
                    haizifuqin = this.Scenario.Persons.GetGameObject(this.suoshurenwu) as Person;

                    if (haizifuqin != null)
                    {
                        int count = 0;
                        do
                        {
                            PersonList origChildren = haizifuqin.meichushengdehaiziliebiao();
                            if (origChildren.Count > 0)
                            {
                                haizi = origChildren[0] as Person;
                                haizi.father = this.Sex ? haizifuqin.ID : this.ID;
                                haizi.mother = this.Sex ? this.ID : haizifuqin.ID;
                            }
                            else
                            {
                                haizi = Person.createChildren(this.Scenario.Persons.GetGameObject(this.suoshurenwu) as Person, this);
                            }

                            base.Scenario.YearTable.addChildrenBornEntry(base.Scenario.Date, haizifuqin, this, haizi);

                            haizifuqin.TextResultString = haizi.Name;

                            base.Scenario.GameScreen.xiaohaichusheng(haizifuqin, haizi);
                            base.Scenario.haizichusheng(haizi, haizifuqin, this, origChildren.Count > 0);

                            count++;
                        } while ((GameObject.Chance(haizifuqin.multipleChildrenRate) || GameObject.Chance(this.multipleChildrenRate)) && count < Math.Max(haizifuqin.maxChildren, this.maxChildren));

                        haizifuqin.suoshurenwu = -1;
                    }

                    this.suoshurenwu = -1;

                }
            }
        }
コード例 #2
0
        private void huaiyunshijian()
        {
            if (this.huaiyun)
            {
                this.huaiyuntianshu++;
                //if (this.huaiyuntianshu == 30)
                if (GameObject.Chance((this.huaiyuntianshu - 20) * 5) && !this.faxianhuaiyun)
                {
                    this.faxianhuaiyun = true;
                    this.Scenario.GameScreen.faxianhuaiyun(this);
                }
                else if (GameObject.Chance((this.huaiyuntianshu - 290) * 5))
                {
                    Person haizifuqin = new Person();
                    Person haizi = new Person();
                    this.huaiyun = false;
                    this.faxianhuaiyun = false;
                    this.huaiyuntianshu = -1;

                    if (this.suoshurenwu == -1)
                    {
                        this.suoshurenwu = this.FeiZiLocationArchitecture.BelongedFaction.LeaderID;
                    }
                    haizifuqin = this.Scenario.Persons.GetGameObject(this.suoshurenwu) as Person;

                    PersonList origChildren = haizifuqin.meichushengdehaiziliebiao();
                    if (origChildren.Count > 0)
                    {
                        haizi = origChildren[0] as Person;
                    }
                    else
                    {
                        haizi = this.createChildren(this.Scenario.Persons.GetGameObject(this.suoshurenwu) as Person, this);
                    }

                    haizifuqin.TextResultString = haizi.Name;

                    base.Scenario.GameScreen.xiaohaichusheng(haizifuqin);
                    base.Scenario.haizichusheng(haizi, this);

                    this.suoshurenwu = -1;
                    haizifuqin.suoshurenwu = -1;

                }
            }
        }
コード例 #3
0
ファイル: Person.cs プロジェクト: ptmaster/ZhongHuaSanGuoZhi
        private void huaiyunshijian()
        {
            if (this.huaiyun)
            {
                this.huaiyuntianshu++;
                //if (this.huaiyuntianshu == 30)
                if (GameObject.Chance((this.huaiyuntianshu - 20) * 5) && !this.faxianhuaiyun)
                {
                    ExtensionInterface.call("FoundPregnant", new Object[] { this.Scenario, this });
                    this.faxianhuaiyun = true;
                    if (this.BelongedFaction != null && this == this.BelongedFaction.Leader)  //女君主自己怀孕
                    {
                        this.Scenario.GameScreen.selfFoundPregnant(this);
                    }
                    else
                    {
                        if (this.Status == PersonStatus.Princess)
                        {
                            this.Scenario.GameScreen.faxianhuaiyun(this);
                        }
                        else
                        {
                            this.Scenario.GameScreen.coupleFoundPregnant(this);
                        }
                    }
                }
                else if (GameObject.Chance((this.huaiyuntianshu - 290) * 5))
                {
                    Person haizifuqin = new Person();
                    Person haizi = new Person();
                    this.huaiyun = false;
                    this.faxianhuaiyun = false;
                    this.huaiyuntianshu = -1;

                    if (this.suoshurenwu == -1)
                    {
                        if (this.BelongedFaction != null)
                        {
                            this.suoshurenwu = this.BelongedFaction.LeaderID;
                        }
                        else
                        {
                            return;
                        }
                    }
                    haizifuqin = this.Scenario.Persons.GetGameObject(this.suoshurenwu) as Person;

                    if (haizifuqin != null)
                    {
                        int count = 0;
                        do
                        {
                            PersonList origChildren = haizifuqin.meichushengdehaiziliebiao();
                            if (origChildren.Count > 0)
                            {
                                haizi = origChildren[0] as Person;
                                haizi.father = this.Sex ? haizifuqin : this;
                                haizi.mother = this.Sex ? this : haizifuqin;
                            }
                            else
                            {
                                haizi = Person.createChildren(this.Scenario.Persons.GetGameObject(this.suoshurenwu) as Person, this);
                            }

                            base.Scenario.YearTable.addChildrenBornEntry(base.Scenario.Date, haizifuqin, this, haizi);

                            haizifuqin.TextResultString = haizi.Name;

                            base.Scenario.GameScreen.xiaohaichusheng(haizifuqin, haizi);
                            base.Scenario.haizichusheng(haizi, haizifuqin, this, origChildren.Count > 0);

                            count++;
                        } while ((GameObject.Chance(haizifuqin.multipleChildrenRate) || GameObject.Chance(this.multipleChildrenRate)) && count < Math.Max(haizifuqin.maxChildren, this.maxChildren));

                        haizifuqin.suoshurenwu = -1;
                    }

                    this.suoshurenwu = -1;

                }
            }
            else if (this.Spouse != null && !this.huaiyun && !this.Spouse.huaiyun && GlobalVariables.getChildrenRate > 0 &&
                GameObject.Random((int) (10000.0 / GlobalVariables.getChildrenRate * 20)) == 0 &&
                (this.LocationArchitecture != null && this.Spouse.LocationArchitecture == this.LocationArchitecture ||
                    (this.LocationTroop != null && this.Spouse.LocationTroop == this.LocationTroop)) &&
                this.Status == PersonStatus.Normal && this.Spouse.Status == PersonStatus.Normal &&
                this.isLegalFeiZi(this.Spouse) && this.Spouse.isLegalFeiZi(this))
            {
                this.suoshurenwu = this.Spouse.ID;
                this.Spouse.suoshurenwu = this.ID;
                if (this.Sex)
                {
                    this.huaiyun = true;
                    this.huaiyuntianshu = 0;
                }
                else
                {
                    this.Spouse.huaiyun = true;
                    this.Spouse.huaiyuntianshu = 0;
                }
            }
        }