Example #1
0
 private bool DoSearchTreasure(SearchResultPack pack)
 {
     if (this.InevitableSuccessOfSearch || (GameObject.Random(this.TargetArchitecture.Morale + this.SearchAbility) >= GameObject.Random(0x3e8)))
     {
         foreach (Treasure treasure in base.Scenario.Treasures.GetRandomList())
         {
             if (((!treasure.Available && (treasure.BelongedPerson == null)) && (treasure.HidePlace == this.TargetArchitecture)) && (treasure.AppearYear <= base.Scenario.Date.Year))
             {
                 if (GameObject.Random(treasure.Worth) <= GameObject.Random(Parameters.FindTreasureChance))
                 {
                     treasure.Available = true;
                     this.ReceiveTreasure(treasure);
                     if (this.OnTreasureFound != null)
                     {
                         this.OnTreasureFound(this, treasure);
                     }
                 }
                 break;
             }
         }
     }
     return false;
 }
Example #2
0
 private bool DoSearchSpy(SearchResultPack pack)
 {
     if (this.TargetArchitecture.HasSpy && (this.InevitableSuccessOfSearch || (GameObject.Random(this.SearchAbility + 500) > 500)))
     {
         SpyPack sp = this.TargetArchitecture.SpyPacks[GameObject.Random(this.TargetArchitecture.SpyPacks.Count)];
         if (sp.SpyPerson.BelongedFaction != this.BelongedFaction)
         {
             if (sp.SpyPerson.BelongedFaction != null)
             {
                 base.Scenario.ChangeDiplomaticRelation(this.BelongedFaction.ID, sp.SpyPerson.BelongedFaction.ID, -10);
             }
             if (this.OnSpyFound != null)
             {
                 this.OnSpyFound(this, sp.SpyPerson);
             }
             pack.FoundPerson = sp.SpyPerson;
         }
         this.TargetArchitecture.RemoveSpyPack(sp);
         return true;
     }
     return false;
 }
Example #3
0
 private bool DoSearchTechnique(SearchResultPack pack)
 {
     if (this.InevitableSuccessOfSearch || (GameObject.Random(this.TargetArchitecture.Morale + this.SearchAbility) >= GameObject.Random(0x3e8)))
     {
         pack.Number = this.SearchAbility * 2;
         pack.Number = (pack.Number / 2) + GameObject.Random(pack.Number);
         return true;
     }
     return false;
 }
Example #4
0
 private bool DoSearchFund(SearchResultPack pack)
 {
     if (this.InevitableSuccessOfSearch || (GameObject.Random(this.TargetArchitecture.Morale + this.SearchAbility) >= GameObject.Random(0x3e8)))
     {
         pack.Number = StaticMethods.GetRandomValue(this.SearchAbility, 2);
         pack.Number = (pack.Number / 2) + GameObject.Random(pack.Number);
         this.TargetArchitecture.IncreaseFund(pack.Number);
         return true;
     }
     return false;
 }
Example #5
0
 private bool DoSearchPerson(SearchResultPack pack)
 {
     if (this.InevitableSuccessOfSearch || (GameObject.Random(this.TargetArchitecture.Morale + this.SearchAbility) >= GameObject.Random(0x3e8)))
     {
         foreach (Person person in base.Scenario.Persons)
         {
             if (((((!person.Available && person.Alive) && (person.YearAvailable <= base.Scenario.Date.Year)) && GameObject.Chance(20)) && (person.AvailableLocation == this.TargetArchitecture.ID)) && ((((((GlobalVariables.CommonPersonAvailable && (person.ID >= 0)) && (person.ID <= 0x1b57)) || ((GlobalVariables.AdditionalPersonAvailable && (person.ID >= 0x1f40)) && (person.ID <= 0x2327))) || ((GlobalVariables.PlayerPersonAvailable && (person.ID >= 0x2328)) && (person.ID <= 0x270f))) && !base.Scenario.PreparedAvailablePersons.HasGameObject(person)) && person.BeAvailable()))
             {
                 pack.FoundPerson = person;
                 return true;
             }
         }
     }
     return false;
 }
Example #6
0
        public void DoSearch()
        {
            this.OutsideTask = OutsideTaskKind.无;
            if ((this.TargetArchitecture != null) && (this.TargetArchitecture.BelongedFaction == this.BelongedFaction))
            {
                SearchResultPack pack = new SearchResultPack();
                bool flag = false;
                bool flag2 = false;
                bool flag3 = false;
                bool flag4 = false;
                if (this.InevitableSuccessOfSearch)
                {
                    pack.Result = (SearchResult) (GameObject.Random(Enum.GetNames(typeof(SearchResult)).Length - 1) + 1);
                }
                else
                {
                    pack.Result = (SearchResult) GameObject.Random(Enum.GetNames(typeof(SearchResult)).Length);
                }
                switch (pack.Result)
                {
                    case SearchResult.资金:
                        flag = this.DoSearchFund(pack);
                        break;

                    case SearchResult.粮草:
                        flag = this.DoSearchFood(pack);
                        break;

                    case SearchResult.技巧:
                        flag = this.DoSearchTechnique(pack);
                        break;

                    case SearchResult.间谍:
                        flag = this.DoSearchSpy(pack);
                        flag2 = flag;
                        break;

                    case SearchResult.隐士:
                        flag = this.DoSearchPerson(pack);
                        flag3 = flag;
                        break;

                    case SearchResult.宝物:
                        flag = this.DoSearchTreasure(pack);
                        flag4 = flag;
                        break;
                }
                if (!flag && this.InevitableSuccessOfSearch)
                {
                    switch (GameObject.Random(3))
                    {
                        case 0:
                            pack.Result = SearchResult.资金;
                            flag = this.DoSearchFund(pack);
                            break;

                        case 1:
                            pack.Result = SearchResult.粮草;
                            flag = this.DoSearchFood(pack);
                            break;

                        case 2:
                            pack.Result = SearchResult.技巧;
                            flag = this.DoSearchTechnique(pack);
                            break;
                    }
                }
                if (flag)
                {
                    this.AddTacticsExperience(20);
                    this.AddIntelligenceExperience(5);
                    this.AddPoliticsExperience(5);
                    this.AddGlamourExperience(10);
                    this.IncreaseReputation(20);
                    this.BelongedFaction.IncreaseReputation(10 * this.MultipleOfTacticsReputation);
                    this.BelongedFaction.IncreaseTechniquePoint((10 * this.MultipleOfTacticsTechniquePoint) * 100);
                    if (this.OnSearchFinished != null)
                    {
                        this.OnSearchFinished(this, this.TargetArchitecture, pack);
                    }
                }
                else
                {
                    pack.Result = SearchResult.无;
                    if (this.OnSearchFinished != null)
                    {
                        this.OnSearchFinished(this, this.TargetArchitecture, pack);
                    }
                }
            }
        }
Example #7
0
 public virtual void PersonSearchFinished(Person person, Architecture architecture, SearchResultPack resultPack)
 {
 }
 private void person_OnSearchFinished(Person person, Architecture architecture, SearchResultPack resultPack)
 {
     person.Scenario.GameScreen.PersonSearchFinished(person, architecture, resultPack);
 }
        public override void PersonSearchFinished(Person person, Architecture architecture, SearchResultPack resultPack)
        {
            if (((base.Scenario.CurrentPlayer == null) || base.Scenario.IsCurrentPlayer(person.BelongedFaction)) || GlobalVariables.SkyEye)
            {
                person.TextDestinationString = architecture.Name;
                if (person.shoudongsousuo)
                {
                    switch (resultPack.Result)
                    {
                        case SearchResult.资金:
                            person.TextResultString = resultPack.Number.ToString();
                            //this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchFundFound");
                            this.xianshishijiantupian(person, person.TextResultString, "SearchFundFound", "", "", architecture.Name,false );
                            break;

                        case SearchResult.粮草:
                            person.TextResultString = resultPack.Number.ToString();
                            //this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchFoodFound");
                            this.xianshishijiantupian(person, person.TextResultString, "SearchFoodFound", "", "", architecture.Name,false );

                            break;

                        case SearchResult.技巧:
                            person.TextResultString = resultPack.Number.ToString();
                            //this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchTechniqueFound");
                            this.xianshishijiantupian(person, person.TextResultString, "SearchTechniqueFound", "", "", architecture.Name,false );

                            break;

                        case SearchResult.间谍:
                            person.TextResultString = resultPack.FoundPerson.Name;
                            //this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchSpyFound");
                            this.xianshishijiantupian(person, person.TextResultString, "SearchSpyFound", "", "", architecture.Name,false );

                            this.Plugins.GameRecordPlugin.AddBranch(person, "SearchSpyFound", person.Position);
                            break;

                        case SearchResult.隐士:
                            person.TextResultString = resultPack.FoundPerson.Name;
                            //this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchPersonFound");
                            this.xianshishijiantupian(person, person.TextResultString, "SearchPersonFound", "", "", architecture.Name,false );

                            this.Plugins.GameRecordPlugin.AddBranch(person, "SearchPersonFound", person.Position);
                            break;
                        case SearchResult.无:
                            //person.TextResultString = architecture.Name;
                            //this.xianshishijiantupian(person, person.TextResultString, "SearchPersonFound", "", "", architecture.Name);
                            //this.Plugins.GameRecordPlugin.AddBranch(person, "SearchNoFound", person.Position);
                            break;
                    }
                    person.shoudongsousuo = false;

                }
                else
                {
                    switch (resultPack.Result)
                    {
                        case SearchResult.资金:
                            person.TextResultString = resultPack.Number.ToString();
                            this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchFundFound");
                            break;

                        case SearchResult.粮草:
                            person.TextResultString = resultPack.Number.ToString();
                            this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchFoodFound");

                            break;

                        case SearchResult.技巧:
                            person.TextResultString = resultPack.Number.ToString();
                            this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchTechniqueFound");

                            break;

                        case SearchResult.间谍:
                            person.TextResultString = resultPack.FoundPerson.Name;
                            this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchSpyFound");

                            this.Plugins.GameRecordPlugin.AddBranch(person, "SearchSpyFound", person.Position);
                            break;

                        case SearchResult.隐士:
                            person.TextResultString = resultPack.FoundPerson.Name;
                            this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchPersonFound");

                            this.Plugins.GameRecordPlugin.AddBranch(person, "SearchPersonFound", person.Position);
                            break;
                    }

                }// end if (person.shoudongsousuo)
            }
        }
        public override void PersonSearchFinished(Person person, Architecture architecture, SearchResultPack resultPack)
        {
            if (((base.Scenario.CurrentPlayer == null) || base.Scenario.IsCurrentPlayer(person.BelongedFaction)) || GlobalVariables.SkyEye)
            {
                person.TextDestinationString = architecture.Name;
                switch (resultPack.Result)
                {
                    case SearchResult.资金:
                        person.TextResultString = resultPack.Number.ToString();
                        this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchFundFound");
                        break;

                    case SearchResult.粮草:
                        person.TextResultString = resultPack.Number.ToString();
                        this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchFoodFound");
                        break;

                    case SearchResult.技巧:
                        person.TextResultString = resultPack.Number.ToString();
                        this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchTechniqueFound");
                        break;

                    case SearchResult.间谍:
                        person.TextResultString = resultPack.FoundPerson.Name;
                        this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchSpyFound");
                        this.Plugins.GameRecordPlugin.AddBranch(person, "SearchSpyFound", person.Position);
                        break;

                    case SearchResult.隐士:
                        person.TextResultString = resultPack.FoundPerson.Name;
                        this.Plugins.PersonBubblePlugin.AddPerson(person, architecture.Position, "SearchPersonFound");
                        this.Plugins.GameRecordPlugin.AddBranch(person, "SearchPersonFound", person.Position);
                        break;
                }
            }
        }