예제 #1
0
        public GameObjectList GetGameObjectList()
        {
            GameObjectList list = new GameObjectList();

            list.Add(this);
            return(list);
        }
 public GameObjectList GetDiplomaticRelationDisplayListByFactionID(int factionID)
 {
     GameObjectList list = new GameObjectList();
     foreach (DiplomaticRelation relation in this.DiplomaticRelations.Values)
     {
         if (relation.RelationFaction1ID == factionID)
         {
             list.Add(new DiplomaticRelationDisplay(relation, relation.RelationFaction2String));
         }
         else if (relation.RelationFaction2ID == factionID)
         {
             list.Add(new DiplomaticRelationDisplay(relation, relation.RelationFaction1String));
         }
     }
     return list;
 }
예제 #3
0
 public GameObjectList GetBiographyList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Biography biography in this.Biographys.Values)
     {
         list.Add(biography);
     }
     return list;
 }
 public GameObjectList GetFacilityKindList()
 {
     GameObjectList list = new GameObjectList();
     foreach (FacilityKind kind in this.FacilityKinds.Values)
     {
         list.Add(kind);
     }
     return list;
 }
 public GameObjectList GetArchitectureKindList()
 {
     GameObjectList list = new GameObjectList();
     foreach (ArchitectureKind kind in this.ArchitectureKinds.Values)
     {
         list.Add(kind);
     }
     return list;
 }
 public GameObjectList GetSectionAIDetailList()
 {
     GameObjectList list = new GameObjectList();
     foreach (SectionAIDetail detail in this.SectionAIDetails.Values)
     {
         list.Add(detail);
     }
     return list;
 }
 public GameObjectList GetTextMessageList()
 {
     GameObjectList list = new GameObjectList();
     foreach (TextMessage message in this.TextMessages.Values)
     {
         list.Add(message);
     }
     return list;
 }
 public GameObjectList GetTerrainDetailList()
 {
     GameObjectList list = new GameObjectList();
     foreach (TerrainDetail detail in this.TerrainDetails.Values)
     {
         list.Add(detail);
     }
     return list;
 }
 public GameObjectList GetEventEffectKindList()
 {
     GameObjectList list = new GameObjectList();
     foreach (EventEffectKind kind in this.EventEffectKinds.Values)
     {
         list.Add(kind);
     }
     return list;
 }
 public GameObjectList Getzainanzhongleiliebiao()
 {
     GameObjectList list = new GameObjectList();
     foreach (zainanzhongleilei kind in this.zainanzhongleizidian.Values)
     {
         list.Add(kind);
     }
     return list;
 }
예제 #11
0
 public GameObjectList GetStratagemList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Stratagem stratagem in this.Stratagems.Values)
     {
         list.Add(stratagem);
     }
     return list;
 }
예제 #12
0
 public GameObjectList GetStuntList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Stunt stunt in this.Stunts.Values)
     {
         list.Add(stunt);
     }
     return list;
 }
예제 #13
0
 public GameObjectList GetCombatMethodList()
 {
     GameObjectList list = new GameObjectList();
     foreach (CombatMethod method in this.CombatMethods.Values)
     {
         list.Add(method);
     }
     return list;
 }
예제 #14
0
 public GameObjectList GetSkillList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Skill skill in this.Skills.Values)
     {
         list.Add(skill);
     }
     return list;
 }
예제 #15
0
 public GameObjectList GetConditionList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Condition condition in this.Conditions.Values)
     {
         list.Add(condition);
     }
     return list;
 }
 public GameObjectList GetAllDiplomaticRelationDisplayList()
 {
     GameObjectList list = new GameObjectList();
     foreach (DiplomaticRelation relation in this.DiplomaticRelations.Values)
     {
         list.Add(new DiplomaticRelationDisplay(relation, relation.RelationFaction1String));
     }
     return list;
 }
예제 #17
0
 public GameObjectList GetEventEffectList()
 {
     GameObjectList list = new GameObjectList();
     foreach (EventEffect effect in this.EventEffects.Values)
     {
         list.Add(effect);
     }
     return list;
 }
예제 #18
0
 public GameObjectList GetAnimationList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Animation animation in this.Animations.Values)
     {
         list.Add(animation);
     }
     return list;
 }
 public GameObjectList Getguanjuedezhongleiliebiao()
 {
     GameObjectList list = new GameObjectList();
     foreach (guanjuezhongleilei kind in this.guanjuedezhongleizidian.Values)
     {
         list.Add(kind);
     }
     return list;
 }
 public GameObjectList GetConditionKindList()
 {
     GameObjectList list = new GameObjectList();
     foreach (ConditionKind kind in this.ConditionKinds.Values)
     {
         list.Add(kind);
     }
     return list;
 }
예제 #21
0
 public GameObjectList GetTechniqueList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Technique technique in this.Techniques.Values)
     {
         list.Add(technique);
     }
     return list;
 }
예제 #22
0
 public GameObjectList GetTitleList()
 {
     GameObjectList list = new GameObjectList();
     foreach (Title title in this.Titles.Values)
     {
         list.Add(title);
     }
     return list;
 }
 public GameObjectList GetInfluenceKindList()
 {
     GameObjectList list = new GameObjectList();
     foreach (InfluenceKind kind in this.InfluenceKinds.Values)
     {
         list.Add(kind);
     }
     return list;
 }
예제 #24
0
        public GameObjectList Getzainanzhongleiliebiao()
        {
            GameObjectList list = new GameObjectList();

            foreach (zainanzhongleilei kind in this.zainanzhongleizidian.Values)
            {
                list.Add(kind);
            }
            return(list);
        }
예제 #25
0
        public GameObjectList GetList()
        {
            GameObjectList list = new GameObjectList();

            foreach (GameObject obj2 in this.gameObjects)
            {
                list.Add(obj2);
            }
            return(list);
        }
예제 #26
0
        public GameObjectList Getguanjuedezhongleiliebiao()
        {
            GameObjectList list = new GameObjectList();

            foreach (guanjuezhongleilei kind in this.guanjuedezhongleizidian.Values)
            {
                list.Add(kind);
            }
            return(list);
        }
예제 #27
0
        public GameObjectList GetRandomList()
        {
            GameObjectList list = new GameObjectList();

            foreach (int num in this.GenerateRandomIndexList())
            {
                list.Add(this.gameObjects[num]);
            }
            return(list);
        }
 public GameObjectList GetSectionNoOrientationAutoAIDetailsByConditions(bool allowOffensiveCampaign, bool valueRecruitment)
 {
     GameObjectList list = new GameObjectList();
     foreach (SectionAIDetail detail in this.SectionAIDetails.Values)
     {
         if ((((detail.OrientationKind == SectionOrientationKind.无) && detail.AutoRun) && (detail.AllowOffensiveCampaign == allowOffensiveCampaign)) && (detail.ValueRecruitment == valueRecruitment))
         {
             list.Add(detail);
         }
     }
     return list;
 }
 public GameObjectList GetSectionAIDetailsByConditions(SectionOrientationKind orientationKind, bool autoRun, bool valueOffensiveCampaign, bool allowOffensiveCampaign, bool allowMilitaryTransfer, bool valueRecruitment)
 {
     GameObjectList list = new GameObjectList();
     foreach (SectionAIDetail detail in this.SectionAIDetails.Values)
     {
         if (((((detail.OrientationKind == orientationKind) && (detail.AutoRun == autoRun)) && ((detail.ValueOffensiveCampaign == valueOffensiveCampaign) && (detail.AllowOffensiveCampaign == allowOffensiveCampaign))) && (detail.AllowMilitaryTransfer == allowMilitaryTransfer)) && (detail.ValueRecruitment == valueRecruitment))
         {
             list.Add(detail);
         }
     }
     return list;
 }
예제 #30
0
        public GameObjectList GetSelectedList()
        {
            GameObjectList list = new GameObjectList();

            foreach (GameObject obj2 in this.gameObjects)
            {
                if (obj2.Selected)
                {
                    list.Add(obj2);
                }
            }
            return(list);
        }
예제 #31
0
        public GameObjectList GetMinObjects(int count)
        {
            int num;

            if (count > this.Count)
            {
                count = this.Count;
            }
            GameObjectList list = new GameObjectList();

            if (this.SmallToBig)
            {
                for (num = 0; num < count; num++)
                {
                    list.Add(this[num]);
                }
                return(list);
            }
            for (num = count - 1; num >= 0; num--)
            {
                list.Add(this[num]);
            }
            return(list);
        }
예제 #32
0
        public GameObjectList GetList(params GameObjectCondition[] conditions)
        {
            GameObjectList list = new GameObjectList();

            foreach (GameObject obj2 in this.gameObjects)
            {
                bool flag = true;
                for (int i = 0; i < conditions.Length; i++)
                {
                    if (conditions[i].LEG == 0)
                    {
                        if (!StaticMethods.GetPropertyValue(obj2, conditions[i].PropertyName).Equals(conditions[i].PropertyValue))
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if (conditions[i].LEG > 0)
                    {
                        if (((int)StaticMethods.GetPropertyValue(obj2, conditions[i].PropertyName)) <= ((int)conditions[i].PropertyValue))
                        {
                            flag = false;
                            break;
                        }
                    }
                    else if ((conditions[i].LEG < 0) && (((int)StaticMethods.GetPropertyValue(obj2, conditions[i].PropertyName)) >= ((int)conditions[i].PropertyValue)))
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    list.Add(obj2);
                }
            }
            return(list);
        }
예제 #33
0
 public void NoFactionMove()
 {
     if (((((this.BelongedFaction == null) && (this.ArrivingDays == 0)) && (this.LocationArchitecture != null)) && !this.IsCaptive) && GameObject.Chance((2 + (int) this.Ambition) + (this.LeaderPossibility ? 10 : 0)))
     {
         if (GameObject.Chance(50 + (this.LeaderPossibility ? 10 : 0)))
         {
             GameObjectList hirableFactionList = this.GetHirableFactionList();
             if (hirableFactionList.Count > 0)
             {
                 GameObjects.Faction faction = hirableFactionList[GameObject.Random(hirableFactionList.Count)] as GameObjects.Faction;
                 if (((faction.Leader != null) && (GetIdealOffset(faction.Leader, this) <= 10)) && ((faction.Capital != null) && (faction.Capital != this.LocationArchitecture)))
                 {
                     this.MoveToArchitecture(faction.Capital);
                     this.LocationArchitecture.RemoveNoFactionPerson(this);
                 }
             }
             else if (this.LeaderPossibility)
             {
                 GameObjectList list2 = new GameObjectList();
                 foreach (Architecture architecture in this.LocationArchitecture.GetClosestArchitectures(40))
                 {
                     if ((architecture.BelongedFaction == null) && (architecture.RecentlyAttacked <= 0))
                     {
                         list2.Add(architecture);
                     }
                 }
                 if (list2.Count > 0)
                 {
                     if (list2.Count > 1)
                     {
                         list2.PropertyName = "UnitPopulation";
                         list2.IsNumber = true;
                         list2.ReSort();
                     }
                     Architecture a = list2[GameObject.Random(list2.Count / 2)] as Architecture;
                     this.MoveToArchitecture(a);
                     this.LocationArchitecture.RemoveNoFactionPerson(this);
                 }
             }
         }
         else
         {
             if (this.LocationArchitecture.ClosestArchitectures == null)
             {
                 this.LocationArchitecture.GetClosestArchitectures();
             }
             if (this.LocationArchitecture.ClosestArchitectures.Count > 0)
             {
                 int maxValue = 20;
                 if (maxValue > this.LocationArchitecture.ClosestArchitectures.Count)
                 {
                     maxValue = this.LocationArchitecture.ClosestArchitectures.Count;
                 }
                 maxValue = GameObject.Random(maxValue);
                 this.MoveToArchitecture(this.LocationArchitecture.ClosestArchitectures[maxValue] as Architecture);
                 this.LocationArchitecture.RemoveNoFactionPerson(this);
             }
         }
     }
 }
예제 #34
0
 private void LeaveFaction()
 {
     if (GameObject.Chance(20) && ((((this.LocationArchitecture != null) && (this.BelongedFaction != null)) && (this.BelongedFaction.Leader != this)) && !this.IsCaptive))
     {
         if ((this.Loyalty < 50) && (GameObject.Random(this.Loyalty * (1 + (int)this.PersonalLoyalty)) <= GameObject.Random(5)))
         {
             this.LeaveToNoFaction();
         }
         else if (((GlobalVariables.IdealTendencyValid && (this.IdealTendency != null)) && (this.IdealTendency.Offset <= 1)) && (this.BelongedFaction.Leader != null))
         {
             int idealOffset = GetIdealOffset(this, this.BelongedFaction.Leader);
             if (idealOffset > this.IdealTendency.Offset)
             {
                 GameObjectList list = new GameObjectList();
                 foreach (GameObjects.Faction faction in base.Scenario.Factions)
                 {
                     if (((faction != this.BelongedFaction) && (faction.Leader != null)) && (GetIdealOffset(this, faction.Leader) <= this.IdealTendency.Offset))
                     {
                         list.Add(faction);
                     }
                 }
                 if (list.Count > 0)
                 {
                     GameObjects.Faction faction2 = list[GameObject.Random(list.Count)] as GameObjects.Faction;
                     if ((faction2.Capital != null) && ((((this.PersonalLoyalty < PersonLoyalty.很高) || ((this.Father >= 0) && (this.Father == faction2.Leader.ID))) || ((this.Brother >= 0) && (this.Brother == faction2.Leader.ID))) || (idealOffset > 10)))
                     {
                         this.LeaveToNoFaction();
                         this.MoveToArchitecture(faction2.Capital);
                         this.LocationArchitecture.RemoveNoFactionPerson(this);
                     }
                 }
             }
         }
     }
 }
예제 #35
0
 public GameObjectList GetHirableFactionList()
 {
     GameObjectList list = new GameObjectList();
     foreach (GameObjects.Faction faction in base.Scenario.Factions)
     {
         if (this.IsHirable(faction))
         {
             list.Add(faction);
         }
     }
     return list;
 }
예제 #36
0
 public GameObjectList GetSelectedList()
 {
     GameObjectList list = new GameObjectList();
     foreach (GameObject obj2 in this.gameObjects)
     {
         if (obj2.Selected)
         {
             list.Add(obj2);
         }
     }
     return list;
 }
예제 #37
0
 public GameObjectList GetRandomList()
 {
     GameObjectList list = new GameObjectList();
     foreach (int num in this.GenerateRandomIndexList())
     {
         list.Add(this.gameObjects[num]);
     }
     return list;
 }
예제 #38
0
 public GameObjectList GetMinObjects(int count)
 {
     int num;
     if (count > this.Count)
     {
         count = this.Count;
     }
     GameObjectList list = new GameObjectList();
     if (this.SmallToBig)
     {
         for (num = 0; num < count; num++)
         {
             list.Add(this[num]);
         }
         return list;
     }
     for (num = count - 1; num >= 0; num--)
     {
         list.Add(this[num]);
     }
     return list;
 }
예제 #39
0
파일: Event.cs 프로젝트: zhaohuwei/ZHSan
        public bool matchEventPersons(Architecture a)
        {
            GameObjectList allPersons = a.PersonAndChildren.GetList();

            foreach (Person p in a.NoFactionPersons)
            {
                allPersons.Add(p);
            }
            foreach (Captive p in a.Captives)
            {
                allPersons.Add(p.CaptivePerson);
            }
            foreach (Person p in a.Feiziliebiao)
            {
                allPersons.Add(p);
            }

            HashSet <int> haveCond = new HashSet <int>();

            foreach (KeyValuePair <int, List <Condition> > i in this.personCond)
            {
                haveCond.Add(i.Key);
            }

            HashSet <int> noCond = new HashSet <int>();

            foreach (KeyValuePair <int, List <Person> > i in this.person)
            {
                if (!haveCond.Contains(i.Key) && i.Value.Count == 0)
                {
                    noCond.Add(i.Key);
                }
            }

            Dictionary <int, List <Person> > candidates = new Dictionary <int, List <Person> >();

            foreach (int i in this.person.Keys)
            {
                candidates[i] = new List <Person>();
                if (noCond.Contains(i))
                {
                    foreach (Person p in allPersons.GetList())
                    {
                        candidates[i].Add(p);
                    }
                }
            }

            // check person in the architecture
            foreach (KeyValuePair <int, List <Condition> > i in this.personCond)
            {
                foreach (Person p in allPersons)
                {
                    bool ok = true;
                    foreach (Condition c in i.Value)
                    {
                        if (!c.CheckCondition(p, this))
                        {
                            ok = false;
                            break;
                        }
                    }
                    if (ok)
                    {
                        if (this.person[i.Key].Contains(null) || this.person[i.Key].Contains(p))
                        {
                            candidates[i.Key].Add(p);
                        }
                    }
                }
            }
            // check 7000 - 8000 persons which can be in anywhere
            foreach (KeyValuePair <int, List <Person> > i in this.person)
            {
                foreach (Person p in i.Value)
                {
                    if (p != null /*&& p.ID >= 7000 && p.ID < 8000*/)
                    {
                        bool ok = true;
                        if (this.personCond.ContainsKey(i.Key))
                        {
                            foreach (Condition c in this.personCond[i.Key])
                            {
                                if (!c.CheckCondition(p, this))
                                {
                                    ok = false;
                                    break;
                                }
                            }
                        }
                        if (ok)
                        {
                            if (this.person[i.Key].Contains(null) || this.person[i.Key].Contains(p))
                            {
                                candidates[i.Key].Add(p);
                            }
                        }
                    }
                }
            }

            foreach (List <Person> i in candidates.Values)
            {
                if (i.Count == 0)
                {
                    return(false);
                }
            }

            Dictionary <int, Person> matchedPersons = new Dictionary <int, Person>();

            foreach (KeyValuePair <int, List <Person> > i in candidates)
            {
                if (i.Value.Count <= 0)
                {
                    return(false);
                }
                Person selected = i.Value[GameObject.Random(i.Value.Count)];
                matchedPersons[i.Key] = selected;
                foreach (List <Person> j in candidates.Values)
                {
                    j.Remove(selected);
                }
            }

            matchedDialog = new List <PersonDialog>();
            foreach (PersonIdDialog i in this.dialog)
            {
                if (!matchedPersons.ContainsKey(i.id))
                {
                    return(false);
                }

                PersonDialog pd = new PersonDialog();
                pd.SpeakingPerson = matchedPersons[i.id];
                pd.Text           = i.dialog;
                for (int j = 0; j < matchedPersons.Count; ++j)
                {
                    pd.Text = pd.Text.Replace("%" + j, matchedPersons[j].Name);
                }
                matchedDialog.Add(pd);
            }

            matchedyesDialog = new List <PersonDialog>();
            foreach (PersonIdDialog i in this.yesdialog)
            {
                if (!matchedPersons.ContainsKey(i.id))
                {
                    return(false);
                }

                PersonDialog pd = new PersonDialog();
                pd.SpeakingPerson = matchedPersons[i.id];
                pd.Text           = i.yesdialog;
                for (int j = 0; j < matchedPersons.Count; ++j)
                {
                    pd.Text = pd.Text.Replace("%" + j, ' ' + matchedPersons[j].Name + ' ');
                }
                matchedyesDialog.Add(pd);
            }

            matchednoDialog = new List <PersonDialog>();
            foreach (PersonIdDialog i in this.nodialog)
            {
                if (!matchedPersons.ContainsKey(i.id))
                {
                    return(false);
                }

                PersonDialog pd = new PersonDialog();
                pd.SpeakingPerson = matchedPersons[i.id];
                pd.Text           = i.nodialog;
                for (int j = 0; j < matchedPersons.Count; ++j)
                {
                    pd.Text = pd.Text.Replace("%" + j, ' ' + matchedPersons[j].Name + ' ');
                }
                matchednoDialog.Add(pd);
            }

            matchedScenBiography = new List <PersonDialog>();
            foreach (PersonIdDialog i in this.scenBiography)
            {
                if (!matchedPersons.ContainsKey(i.id))
                {
                    return(false);
                }

                PersonDialog pd = new PersonDialog();
                pd.SpeakingPerson = matchedPersons[i.id];
                pd.Text           = i.dialog;
                for (int j = 0; j < matchedPersons.Count; ++j)
                {
                    pd.Text = pd.Text.Replace("%" + j, matchedPersons[j].Name);
                }
                matchedScenBiography.Add(pd);
            }

            matchedEffect = new Dictionary <Person, List <EventEffect> >();
            foreach (KeyValuePair <int, List <EventEffect> > i in this.effect)
            {
                matchedEffect.Add(matchedPersons[i.Key], i.Value);
            }
            matchedYesEffect = new Dictionary <Person, List <EventEffect> >();
            foreach (KeyValuePair <int, List <EventEffect> > i in this.yesEffect)
            {
                matchedYesEffect.Add(matchedPersons[i.Key], i.Value);
            }
            matchedNoEffect = new Dictionary <Person, List <EventEffect> >();
            foreach (KeyValuePair <int, List <EventEffect> > i in this.noEffect)
            {
                matchedNoEffect.Add(matchedPersons[i.Key], i.Value);
            }

            return(true);
        }