Beispiel #1
0
        public Stunt GetStunt(int stuntID)
        {
            Stunt stunt = null;

            this.Stunts.TryGetValue(stuntID, out stunt);
            return(stunt);
        }
 public bool AddStunt(Stunt stunt)
 {
     if (this.Stunts.ContainsKey(stunt.ID))
     {
         return false;
     }
     this.Stunts.Add(stunt.ID, stunt);
     return true;
 }
Beispiel #3
0
 public bool RemoveStunt(Stunt stunt)
 {
     if (!this.Stunts.ContainsKey(stunt.ID))
     {
         return(false);
     }
     this.Stunts.Remove(stunt.ID);
     return(true);
 }
 public bool RemoveStunt(Stunt stunt)
 {
     if (!this.Stunts.ContainsKey(stunt.ID))
     {
         return false;
     }
     this.Stunts.Remove(stunt.ID);
     return true;
 }
Beispiel #5
0
 public bool AddStunt(Stunt stunt)
 {
     if (this.Stunts.ContainsKey(stunt.ID))
     {
         return(false);
     }
     this.Stunts.Add(stunt.ID, stunt);
     return(true);
 }
Beispiel #6
0
        public void LoadFromString(StuntTable allStunts, string stuntIDs)
        {
            char[]   separator = new char[] { ' ', '\n', '\r', '\t' };
            string[] strArray  = stuntIDs.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            Stunt    stunt     = null;

            for (int i = 0; i < strArray.Length; i++)
            {
                if (allStunts.Stunts.TryGetValue(int.Parse(strArray[i]), out stunt))
                {
                    this.AddStunt(stunt);
                }
            }
        }
 private void person_OnStudyStuntFinished(Person person, Stunt stunt, bool success)
 {
     person.Scenario.GameScreen.PersonStudyStuntFinished(person, stunt, success);
 }
        public bool LoadFromDatabase(string connectionString)
        {
            int num;
            Animation animation;
            OleDbConnection connection = new OleDbConnection(connectionString);
            connection.Open();
            OleDbDataReader reader = new OleDbCommand("Select * From TerrainDetail", connection).ExecuteReader();
            while (reader.Read())
            {
                TerrainDetail terrainDetail = new TerrainDetail();
                terrainDetail.ID = (short)reader["ID"];
                terrainDetail.Name = reader["Name"].ToString();
                terrainDetail.GraphicLayer = (int)reader["GraphicLayer"];
                terrainDetail.ViewThrough = (bool)reader["ViewThrough"];
                terrainDetail.RoutewayBuildFundCost = (int)reader["RoutewayBuildFundCost"];
                terrainDetail.RoutewayActiveFundCost = (int)reader["RoutewayActiveFundCost"];
                terrainDetail.RoutewayBuildWorkCost = (int)reader["RoutewayBuildWorkCost"];
                terrainDetail.RoutewayConsumptionRate = (float)reader["RoutewayConsumptionRate"];
                terrainDetail.FoodDeposit = (int)reader["FoodDeposit"];
                terrainDetail.FoodRegainDays = (int)reader["FoodRegainDays"];
                terrainDetail.FoodSpringRate = (float)reader["FoodSpringRate"];
                terrainDetail.FoodSummerRate = (float)reader["FoodSummerRate"];
                terrainDetail.FoodAutumnRate = (float)reader["FoodAutumnRate"];
                terrainDetail.FoodWinterRate = (float)reader["FoodWinterRate"];
                terrainDetail.FireDamageRate = (float)reader["FireDamageRate"];
                this.AllTerrainDetails.AddTerrainDetail(terrainDetail);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Color", connection).ExecuteReader();
            while (reader.Read())
            {
                Color item = new Color();
                item.PackedValue = uint.Parse(reader["Code"].ToString());
                this.AllColors.Add(item);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From IdealTendencyKind", connection).ExecuteReader();
            while (reader.Read())
            {
                IdealTendencyKind t = new IdealTendencyKind();
                t.ID = (short)reader["ID"];
                t.Name = reader["Name"].ToString();
                t.Offset = (short)reader["Offset"];
                this.AllIdealTendencyKinds.Add(t);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From CharacterKind", connection).ExecuteReader();
            while (reader.Read())
            {
                CharacterKind kind2 = new CharacterKind();
                kind2.ID = (short)reader["ID"];
                kind2.Name = reader["Name"].ToString();
                kind2.IntelligenceRate = (float)reader["IntelligenceRate"];
                kind2.ChallengeChance = (short)reader["ChallengeChance"];
                kind2.ControversyChance = (short)reader["ControversyChance"];
                this.AllCharacterKinds.Add(kind2);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From ArchitectureKind", connection).ExecuteReader();
            while (reader.Read())
            {
                ArchitectureKind architectureKind = new ArchitectureKind();
                architectureKind.ID = (short)reader["ID"];
                architectureKind.Name = reader["Name"].ToString();
                architectureKind.AgricultureBase = (short)reader["AgricultureBase"];
                architectureKind.AgricultureUnit = (short)reader["AgricultureUnit"];
                architectureKind.CommerceBase = (short)reader["CommerceBase"];
                architectureKind.CommerceUnit = (short)reader["CommerceUnit"];
                architectureKind.TechnologyBase = (short)reader["TechnologyBase"];
                architectureKind.TechnologyUnit = (short)reader["TechnologyUnit"];
                architectureKind.DominationBase = (short)reader["DominationBase"];
                architectureKind.DominationUnit = (short)reader["DominationUnit"];
                architectureKind.MoraleBase = (short)reader["MoraleBase"];
                architectureKind.MoraleUnit = (short)reader["MoraleUnit"];
                architectureKind.EnduranceBase = (short)reader["EnduranceBase"];
                architectureKind.EnduranceUnit = (short)reader["EnduranceUnit"];
                architectureKind.PopulationBase = (int)reader["PopulationBase"];
                architectureKind.PopulationUnit = (int)reader["PopulationUnit"];
                architectureKind.PopulationBoundary = (int)reader["PopulationBoundary"];
                architectureKind.ViewDistance = (short)reader["ViewDistance"];
                architectureKind.ViewDistanceIncrementDivisor = (short)reader["VDIncrementDivisor"];
                architectureKind.HasObliqueView = (bool)reader["HasObliqueView"];
                architectureKind.HasLongView = (bool)reader["HasLongView"];
                architectureKind.HasPopulation = (bool)reader["HasPopulation"];
                architectureKind.HasAgriculture = (bool)reader["HasAgriculture"];
                architectureKind.HasCommerce = (bool)reader["HasCommerce"];
                architectureKind.HasTechnology = (bool)reader["HasTechnology"];
                architectureKind.HasDomination = (bool)reader["HasDomination"];
                architectureKind.HasMorale = (bool)reader["HasMorale"];
                architectureKind.HasEndurance = (bool)reader["HasEndurance"];
                architectureKind.HasHarbor = (bool)reader["HasHarbor"];
                architectureKind.FacilityPositionUnit = (short)reader["FacilityPositionUnit"];
                architectureKind.FundMaxUnit = (int)reader["FundMaxUnit"];
                architectureKind.FoodMaxUnit = (int)reader["FoodMaxUnit"];
                try
                {
                    architectureKind.CountToMerit = (bool)reader["CountToMerit"];
                }
                catch (Exception)
                {
                    architectureKind.CountToMerit = architectureKind.ID == 1 ? true : false;
                }
                this.AllArchitectureKinds.AddArchitectureKind(architectureKind);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From SectionAIDetail", connection).ExecuteReader();
            while (reader.Read())
            {
                SectionAIDetail sectionAIDetail = new SectionAIDetail();
                sectionAIDetail.ID = (short)reader["ID"];
                sectionAIDetail.Name = reader["Name"].ToString();
                sectionAIDetail.Description = reader["Description"].ToString();
                sectionAIDetail.OrientationKind = (SectionOrientationKind)((short)reader["OrientationKind"]);
                sectionAIDetail.AutoRun = (bool)reader["AutoRun"];
                sectionAIDetail.ValueAgriculture = (bool)reader["ValueAgriculture"];
                sectionAIDetail.ValueCommerce = (bool)reader["ValueCommerce"];
                sectionAIDetail.ValueTechnology = (bool)reader["ValueTechnology"];
                sectionAIDetail.ValueDomination = (bool)reader["ValueDomination"];
                sectionAIDetail.ValueMorale = (bool)reader["ValueMorale"];
                sectionAIDetail.ValueEndurance = (bool)reader["ValueEndurance"];
                sectionAIDetail.ValueTraining = (bool)reader["ValueTraining"];
                sectionAIDetail.ValueRecruitment = (bool)reader["ValueRecruitment"];
                sectionAIDetail.ValueNewMilitary = (bool)reader["ValueNewMilitary"];
                sectionAIDetail.ValueOffensiveCampaign = (bool)reader["ValueOffensiveCampaign"];
                sectionAIDetail.AllowInvestigateTactics = (bool)reader["AllowInvestigateTactics"];
                sectionAIDetail.AllowOffensiveTactics = (bool)reader["AllowOffensiveTactics"];
                sectionAIDetail.AllowPersonTactics = (bool)reader["AllowPersonTactics"];
                sectionAIDetail.AllowOffensiveCampaign = (bool)reader["AllowOffensiveCampaign"];
                sectionAIDetail.AllowFundTransfer = (bool)reader["AllowFundTransfer"];
                sectionAIDetail.AllowFoodTransfer = (bool)reader["AllowFoodTransfer"];
                sectionAIDetail.AllowMilitaryTransfer = (bool)reader["AllowMilitaryTransfer"];
                try
                {
                    sectionAIDetail.AllowFacilityRemoval = (bool)reader["AllowFacilityRemoval"];
                }
                catch
                {
                    sectionAIDetail.AllowFacilityRemoval = true;
                }
                this.AllSectionAIDetails.AddSectionAIDetail(sectionAIDetail);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From InfluenceKind", connection).ExecuteReader();
            while (reader.Read())
            {
                num = (short)reader["ID"];
                InfluenceKind ik = InfluenceKindFactory.CreateInfluenceKindByID(num);
                if (ik != null)
                {
                    ik.ID = num;
                    ik.Type = (InfluenceType)((short)reader["Type"]);
                    ik.Name = reader["Name"].ToString();
                    try
                    {
                        ik.Combat = (bool)reader["Combat"];
                    }
                    catch
                    {
                        ik.Combat = true;
                    }
                    this.AllInfluenceKinds.AddInfluenceKind(ik);
                }
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Influence", connection).ExecuteReader();
            while (reader.Read())
            {
                Influence influence = new Influence();
                influence.ID = (short)reader["ID"];
                influence.Name = reader["Name"].ToString();
                influence.Description = reader["Description"].ToString();
                influence.Parameter = reader["Parameter"].ToString();
                influence.Parameter2 = reader["Parameter2"].ToString();
                influence.Kind = this.AllInfluenceKinds.GetInfluenceKind((short)reader["Kind"]);
                if (influence.Kind != null)
                {
                    this.AllInfluences.AddInfluence(influence);
                }
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From ConditionKind", connection).ExecuteReader();
            while (reader.Read())
            {
                num = (short)reader["ID"];
                ConditionKind ck = ConditionKindFactory.CreateConditionKindByID(num);
                if (ck != null)
                {
                    ck.ID = num;
                    ck.Name = reader["Name"].ToString();
                    this.AllConditionKinds.AddConditionKind(ck);
                }
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Condition", connection).ExecuteReader();
            while (reader.Read())
            {
                Condition condition = new Condition();
                condition.ID = (short)reader["ID"];
                condition.Name = reader["Name"].ToString();
                condition.Parameter = reader["Parameter"].ToString();
                condition.Parameter2 = reader["Parameter2"].ToString();
                condition.Kind = this.AllConditionKinds.GetConditionKind((short)reader["Kind"]);
                this.AllConditions.AddCondition(condition);
            }
            connection.Close();

            ///

            connection.Open();
            reader = new OleDbCommand("Select * From TroopEventEffectKind", connection).ExecuteReader();
            while (reader.Read())
            {
                num = (short)reader["ID"];
                EventEffectKind e = EventEffectKindFactory.CreateEventEffectKindByID(num);
                if (e != null)
                {
                    e.ID = num;
                    e.Name = reader["Name"].ToString();
                    this.AllTroopEventEffectKinds.AddEventEffectKind(e);
                }
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From TroopEventEffect", connection).ExecuteReader();
            while (reader.Read())
            {
                GameObjects.TroopDetail.EventEffect.EventEffect effect = new GameObjects.TroopDetail.EventEffect.EventEffect();
                effect.ID = (short)reader["ID"];
                effect.Name = reader["Name"].ToString();
                effect.Parameter = reader["Parameter"].ToString();
                effect.Kind = this.AllTroopEventEffectKinds.GetEventEffectKind((short)reader["Kind"]);
                this.AllTroopEventEffects.AddEventEffect(effect);
            }
            connection.Close();

            //////////////////////////////////////////////////////////

            connection.Open();
            reader = new OleDbCommand("Select * From EventEffectKind", connection).ExecuteReader();
            while (reader.Read())
            {
                num = (short)reader["ID"];
                GameObjects.ArchitectureDetail.EventEffect.EventEffectKind e = GameObjects.ArchitectureDetail.EventEffect.EventEffectKindFactory.CreateEventEffectKindByID(num);
                if (e != null)
                {
                    e.ID = num;
                    e.Name = reader["Name"].ToString();
                    this.AllEventEffectKinds.AddEventEffectKind(e);
                }
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From EventEffect", connection).ExecuteReader();
            while (reader.Read())
            {
                GameObjects.ArchitectureDetail.EventEffect.EventEffect effect = new GameObjects.ArchitectureDetail.EventEffect.EventEffect();
                effect.ID = (short)reader["ID"];
                effect.Name = reader["Name"].ToString();
                effect.Parameter = reader["Parameter"].ToString();
                effect.Parameter2 = reader["Parameter2"].ToString();
                effect.Kind = this.AllEventEffectKinds.GetEventEffectKind((short)reader["Kind"]);
                this.AllEventEffects.AddEventEffect(effect);
            }
            connection.Close();

            //////

            connection.Open();
            reader = new OleDbCommand("Select * From FacilityKind", connection).ExecuteReader();
            while (reader.Read())
            {
                FacilityKind facilityKind = new FacilityKind();
                facilityKind.ID = (short)reader["ID"];
                facilityKind.Name = reader["Name"].ToString();
                try
                {
                    facilityKind.AILevel = (float)reader["AILevel"];
                }
                catch
                {
                    facilityKind.AILevel = 1;
                }
                facilityKind.PositionOccupied = (int)reader["PositionOccupied"];
                facilityKind.TechnologyNeeded = (int)reader["TechnologyNeeded"];
                facilityKind.FundCost = (int)reader["FundCost"];
                facilityKind.PointCost = (int)reader["PointCost"];
                facilityKind.MaintenanceCost = (int)reader["MaintenanceCost"];
                facilityKind.Days = (short)reader["Days"];
                facilityKind.Endurance = (int)reader["Endurance"];
                facilityKind.UniqueInArchitecture = (bool)reader["UniqueInArchitecture"];
                facilityKind.UniqueInFaction = (bool)reader["UniqueInFaction"];
                facilityKind.PopulationRelated = (bool)reader["PopulationRelated"];
                facilityKind.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                facilityKind.rongna = (short)reader["rongna"];
                facilityKind.bukechaichu = (bool)reader["bukechaichu"];
                facilityKind.Conditions.LoadFromString(this.AllConditions, reader["Conditions"].ToString());
                this.AllFacilityKinds.AddFacilityKind(facilityKind);
            }
            connection.Close();

            ///////////////////////////////////////////////////////////////////////
            connection.Open();
            reader = new OleDbCommand("Select * From DisasterKind", connection).ExecuteReader();
            while (reader.Read())
            {
                zainanzhongleilei zainanzhonglei = new zainanzhongleilei();

                zainanzhonglei.ID = (short)reader["ID"];
                zainanzhonglei.Name = reader["名称"].ToString();
                zainanzhonglei.shijianxiaxian = (short)reader["时间下限"];
                zainanzhonglei.shijianshangxian = (short)reader["时间上限"];

                zainanzhonglei.renkoushanghai = (short)reader["人口伤害"];
                zainanzhonglei.tongzhishanghai = (short)reader["统治伤害"];
                zainanzhonglei.naijiushanghai = (short)reader["耐久伤害"];
                zainanzhonglei.nongyeshanghai = (short)reader["农业伤害"];
                zainanzhonglei.shangyeshanghai = (short)reader["商业伤害"];
                zainanzhonglei.jishushanghai = (short)reader["技术伤害"];
                zainanzhonglei.minxinshanghai = (short)reader["民心伤害"];

                this.suoyouzainanzhonglei.Addzainanzhonglei(zainanzhonglei);
            }

            connection.Close();

            ///////////////////////////////////////////////////////////////////////

            ///////////////////////////////////////////////////////////////////////
            connection.Open();
            reader = new OleDbCommand("Select * From guanjuezhonglei", connection).ExecuteReader();
            while (reader.Read())
            {
                guanjuezhongleilei guanjuedezhonglei = new guanjuezhongleilei();

                guanjuedezhonglei.ID = (short)reader["ID"];
                guanjuedezhonglei.Name = reader["名称"].ToString();
                guanjuedezhonglei.shengwangshangxian = (int)reader["声望上限"];
                guanjuedezhonglei.xuyaogongxiandu = (int)reader["需要贡献度"];

                guanjuedezhonglei.xuyaochengchi = (short)reader["需要城池"];

                this.suoyouguanjuezhonglei.Addguanjuedezhonglei(guanjuedezhonglei);
            }

            connection.Close();

            ///////////////////////////////////////////////////////////////////////

            connection.Open();
            reader = new OleDbCommand("Select * From Technique", connection).ExecuteReader();
            while (reader.Read())
            {
                Technique technique = new Technique();
                technique.ID = (short)reader["ID"];
                technique.Kind = (short)reader["Kind"];
                technique.DisplayRow = (short)reader["DisplayRow"];
                technique.DisplayCol = (short)reader["DisplayCol"];
                technique.Name = reader["Name"].ToString();
                technique.Description = reader["Description"].ToString();
                technique.PreID = (short)reader["PreID"];
                technique.PostID = (short)reader["PostID"];
                technique.Reputation = (int)reader["Reputation"];
                technique.FundCost = (int)reader["FundCost"];
                technique.PointCost = (int)reader["PointCost"];
                technique.Days = (short)reader["Days"];
                technique.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                this.AllTechniques.AddTechnique(technique);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Skill", connection).ExecuteReader();
            while (reader.Read())
            {
                Skill skill = new Skill();
                skill.ID = (short)reader["ID"];
                skill.DisplayRow = (short)reader["DisplayRow"];
                skill.DisplayCol = (short)reader["DisplayCol"];
                skill.Kind = (short)reader["Kind"];
                skill.Level = (short)reader["Level"];
                skill.Combat = (bool)reader["Combat"];
                skill.Name = reader["Name"].ToString();
                skill.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                skill.Conditions.LoadFromString(this.AllConditions, reader["Conditions"].ToString());
                this.AllSkills.AddSkill(skill);
            }
            connection.Close();

            int titleKindShift = 0;
            connection.Open();
            try
            {
                reader = new OleDbCommand("Select * From TitleKind", connection).ExecuteReader();
                while (reader.Read())
                {
                    TitleKind tk = new TitleKind();
                    tk.ID = (short)reader["ID"];
                    tk.Name = reader["KName"].ToString();
                    tk.Combat = (bool)reader["Combat"];
                    tk.StudyDay = (short)reader["StudyDay"];
                    tk.SuccessRate = (short)reader["SuccessRate"];
                    this.AllTitleKinds.AddTitleKind(tk);
                }
            }
            catch
            {
                TitleKind tk = new TitleKind();
                tk.ID = 1;
                tk.Name = "个人称号";
                tk.Combat = false;
                tk.StudyDay = 90;
                this.AllTitleKinds.AddTitleKind(tk);
                tk = new TitleKind();
                tk.ID = 2;
                tk.Name = "战斗称号";
                tk.Combat = true;
                tk.StudyDay = 90;
                this.AllTitleKinds.AddTitleKind(tk);
                titleKindShift = 1;
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Title", connection).ExecuteReader();
            while (reader.Read())
            {
                Title title = new Title();
                title.ID = (short)reader["ID"];
                title.Kind = this.AllTitleKinds.GetTitleKind((short)reader["Kind"] + titleKindShift);
                title.Level = (short)reader["Level"];
                title.Combat = (bool)reader["Combat"];
                title.Name = reader["Name"].ToString();
                title.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                title.Conditions.LoadFromString(this.AllConditions, reader["Conditions"].ToString());
                this.AllTitles.AddTitle(title);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From MilitaryKind", connection).ExecuteReader();
            while (reader.Read())
            {
                MilitaryKind militaryKind = new MilitaryKind();
                militaryKind.ID = (short)reader["ID"];
                militaryKind.Type = (MilitaryType)((short)reader["Type"]);
                militaryKind.Name = reader["Name"].ToString();
                militaryKind.Description = reader["Description"].ToString();
                militaryKind.Merit = (short)reader["Merit"];
                militaryKind.Speed = (short)reader["Speed"];
                militaryKind.TitleInfluence = (short)reader["TitleInfluence"];
                militaryKind.CreateCost = (int)reader["CreateCost"];
                militaryKind.CreateTechnology = (int)reader["CreateTechnology"];
                militaryKind.IsShell = (bool)reader["IsShell"];
                militaryKind.CreateBesideWater = (bool)reader["CreateBesideWater"];
                militaryKind.Offence = (short)reader["Offence"];
                militaryKind.Defence = (short)reader["Defence"];
                militaryKind.OffenceRadius = (short)reader["OffenceRadius"];
                militaryKind.CounterOffence = (bool)reader["CounterOffence"];
                militaryKind.BeCountered = (bool)reader["BeCountered"];
                militaryKind.ObliqueOffence = (bool)reader["ObliqueOffence"];
                militaryKind.ArrowOffence = (bool)reader["ArrowOffence"];
                militaryKind.AirOffence = (bool)reader["AirOffence"];
                militaryKind.ContactOffence = (bool)reader["ContactOffence"];
                militaryKind.OffenceOnlyBeforeMove = (bool)reader["OffenceOnlyBeforeMove"];
                militaryKind.ArchitectureDamageRate = (float)reader["ArchitectureDamageRate"];
                militaryKind.ArchitectureCounterDamageRate = (float)reader["ArchitectureCounterDamageRate"];
                militaryKind.StratagemRadius = (short)reader["StratagemRadius"];
                militaryKind.ObliqueStratagem = (bool)reader["ObliqueStratagem"];
                militaryKind.ViewRadius = (short)reader["ViewRadius"];
                militaryKind.ObliqueView = (bool)reader["ObliqueView"];
                militaryKind.Movability = (short)reader["Movability"];
                militaryKind.OneAdaptabilityKind = (short)reader["OneAdaptabilityKind"];
                militaryKind.PlainAdaptability = (short)reader["PlainAdaptability"];
                militaryKind.GrasslandAdaptability = (short)reader["GrasslandAdaptability"];
                militaryKind.ForrestAdaptability = (short)reader["ForrestAdaptability"];
                militaryKind.MarshAdaptability = (short)reader["MarshAdaptability"];
                militaryKind.MountainAdaptability = (short)reader["MountainAdaptability"];
                militaryKind.WaterAdaptability = (short)reader["WaterAdaptability"];
                militaryKind.RidgeAdaptability = (short)reader["RidgeAdaptability"];
                militaryKind.WastelandAdaptability = (short)reader["WastelandAdaptability"];
                militaryKind.DesertAdaptability = (short)reader["DesertAdaptability"];
                militaryKind.CliffAdaptability = (short)reader["CliffAdaptability"];
                militaryKind.PlainRate = (float)reader["PlainRate"];
                militaryKind.GrasslandRate = (float)reader["GrasslandRate"];
                militaryKind.ForrestRate = (float)reader["ForrestRate"];
                militaryKind.MarshRate = (float)reader["MarshRate"];
                militaryKind.MountainRate = (float)reader["MountainRate"];
                militaryKind.WaterRate = (float)reader["WaterRate"];
                militaryKind.RidgeRate = (float)reader["RidgeRate"];
                militaryKind.WastelandRate = (float)reader["WastelandRate"];
                militaryKind.DesertRate = (float)reader["DesertRate"];
                militaryKind.CliffRate = (float)reader["CliffRate"];
                militaryKind.InjuryChance = (short)reader["InjuryRate"];
                try
                {
                    militaryKind.FireDamageRate = (float)reader["FireDamageRate"];
                    militaryKind.RecruitLimit = (int)reader["RecruitLimit"];
                }
                catch
                {
                    try
                    {
                        militaryKind.FireDamageRate = (bool)reader["AfraidOfFire"] ? 3.0f : 1.0f;
                        militaryKind.RecruitLimit = (bool)reader["Unique"] ? 1 : 1000;
                    }
                    catch
                    {
                        militaryKind.FireDamageRate = 1.0f;
                        militaryKind.RecruitLimit = 10000;
                    }
                }
                militaryKind.FoodPerSoldier = (short)reader["FoodPerSoldier"];
                militaryKind.RationDays = (int)reader["RationDays"];
                militaryKind.PointsPerSoldier = (int)reader["PointsPerSoldier"];
                militaryKind.MinScale = (int)reader["MinScale"];
                militaryKind.MaxScale = (int)reader["MaxScale"];
                militaryKind.OffencePerScale = (short)reader["OffencePerScale"];
                militaryKind.DefencePerScale = (short)reader["DefencePerScale"];
                militaryKind.CanLevelUp = (bool)reader["CanLevelUp"];
                militaryKind.LevelUpKindID = (short)reader["LevelUpKindID"];
                militaryKind.LevelUpExperience = (int)reader["LevelUpExperience"];
                militaryKind.OffencePer100Experience = (short)reader["OffencePer100Experience"];
                militaryKind.DefencePer100Experience = (short)reader["DefencePer100Experience"];
                militaryKind.AttackDefaultKind = (TroopAttackDefaultKind)((short)reader["AttackDefaultKind"]);
                militaryKind.AttackTargetKind = (TroopAttackTargetKind)((short)reader["AttackTargetKind"]);
                militaryKind.CastDefaultKind = (TroopCastDefaultKind)((short)reader["CastDefaultKind"]);
                militaryKind.CastTargetKind = (TroopCastTargetKind)((short)reader["CastTargetKind"]);
                militaryKind.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                militaryKind.zijinshangxian = (int)reader["zijinshangxian"];
                this.AllMilitaryKinds.AddMilitaryKind(militaryKind);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From MilitaryKind", connection).ExecuteReader();
            while (reader.Read())
            {
                MilitaryKind current = this.AllMilitaryKinds.GetMilitaryKindList().GetGameObject((short)reader["ID"]) as MilitaryKind;
                current.successor = new MilitaryKindTable();
                current.successor.LoadFromString(this.AllMilitaryKinds, reader["Successor"].ToString());
            }
            connection.Close();

            connection.Open();
            reader = new OleDbCommand("Select * From InformationKind", connection).ExecuteReader();
            while (reader.Read())
            {
                InformationKind kind9 = new InformationKind();
                kind9.ID = (short)reader["ID"];
                kind9.Level = (InformationLevel)((short)reader["iLevel"]);
                kind9.Oblique = (bool)reader["Oblique"];
                kind9.Radius = (short)reader["Radius"];
                kind9.CostFund = (int)reader["CostFund"];
                this.AllInformationKinds.Add(kind9);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From AttackDefaultKind", connection).ExecuteReader();
            while (reader.Read())
            {
                AttackDefaultKind kind10 = new AttackDefaultKind();
                kind10.ID = (short)reader["ID"];
                kind10.Name = reader["Name"].ToString();
                this.AllAttackDefaultKinds.Add(kind10);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From AttackTargetKind", connection).ExecuteReader();
            while (reader.Read())
            {
                AttackTargetKind kind11 = new AttackTargetKind();
                kind11.ID = (short)reader["ID"];
                kind11.Name = reader["Name"].ToString();
                this.AllAttackTargetKinds.Add(kind11);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From CombatMethod", connection).ExecuteReader();
            while (reader.Read())
            {
                CombatMethod combatMethod = new CombatMethod();
                combatMethod.ID = (short)reader["ID"];
                combatMethod.Name = reader["Name"].ToString();
                combatMethod.Description = reader["Description"].ToString();
                combatMethod.Combativity = (short)reader["Combativity"];
                combatMethod.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                combatMethod.AttackDefault = this.AllAttackDefaultKinds.GetGameObject((short)reader["AttackDefault"]) as AttackDefaultKind;
                combatMethod.AttackTarget = this.AllAttackTargetKinds.GetGameObject((short)reader["AttackTarget"]) as AttackTargetKind;
                combatMethod.ArchitectureTarget = (bool)reader["ArchitectureTarget"];
                combatMethod.CastConditions.LoadFromString(this.AllConditions, reader["CastConditions"].ToString());
                combatMethod.ViewingHostile = (bool)reader["ViewingHostile"];
                combatMethod.AnimationKind = (TileAnimationKind)((short)reader["AnimationKind"]);
                this.AllCombatMethods.AddCombatMethod(combatMethod);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Stunt", connection).ExecuteReader();
            while (reader.Read())
            {
                Stunt stunt = new Stunt();
                stunt.ID = (short)reader["ID"];
                stunt.Name = reader["Name"].ToString();
                stunt.Combativity = (short)reader["Combativity"];
                stunt.Period = (short)reader["Period"];
                stunt.Animation = (short)reader["Animation"];
                stunt.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                stunt.CastConditions.LoadFromString(this.AllConditions, reader["CastConditions"].ToString());
                stunt.LearnConditions.LoadFromString(this.AllConditions, reader["LearnConditions"].ToString());
                stunt.AIConditions.LoadFromString(this.AllConditions, reader["AIConditions"].ToString());
                this.AllStunts.AddStunt(stunt);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From CastDefaultKind", connection).ExecuteReader();
            while (reader.Read())
            {
                CastDefaultKind kind12 = new CastDefaultKind();
                kind12.ID = (short)reader["ID"];
                kind12.Name = reader["Name"].ToString();
                this.AllCastDefaultKinds.Add(kind12);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From CastTargetKind", connection).ExecuteReader();
            while (reader.Read())
            {
                CastTargetKind kind13 = new CastTargetKind();
                kind13.ID = (short)reader["ID"];
                kind13.Name = reader["Name"].ToString();
                this.AllCastTargetKinds.Add(kind13);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Stratagem", connection).ExecuteReader();
            while (reader.Read())
            {
                Stratagem stratagem = new Stratagem();
                stratagem.ID = (short)reader["ID"];
                stratagem.Name = reader["Name"].ToString();
                stratagem.Description = reader["Description"].ToString();
                stratagem.Combativity = (short)reader["Combativity"];
                stratagem.Chance = (short)reader["Chance"];
                stratagem.TechniquePoint = (int)reader["TechniquePoint"];
                stratagem.Friendly = (bool)reader["Friendly"];
                stratagem.Self = (bool)reader["Self"];
                stratagem.AnimationKind = (TileAnimationKind)((short)reader["AnimationKind"]);
                stratagem.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
                stratagem.CastDefault = this.AllCastDefaultKinds.GetGameObject((short)reader["CastDefault"]) as CastDefaultKind;
                stratagem.CastTarget = this.AllCastTargetKinds.GetGameObject((short)reader["CastTarget"]) as CastTargetKind;
                stratagem.ArchitectureTarget = (bool)reader["ArchitectureTarget"];
                stratagem.RequireInfluenceToUse = (bool)reader["RequireInfluneceToUse"];
                this.AllStratagems.AddStratagem(stratagem);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From TroopAnimation", connection).ExecuteReader();
            while (reader.Read())
            {
                animation = new Animation();
                animation.ID = (short)reader["ID"];
                animation.Name = reader["Name"].ToString();
                animation.FrameCount = (short)reader["FrameCount"];
                animation.StayCount = (short)reader["StayCount"];
                this.AllTroopAnimations.AddAnimation(animation);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From TileAnimation", connection).ExecuteReader();
            while (reader.Read())
            {
                animation = new Animation();
                animation.ID = (short)reader["ID"];
                animation.Name = reader["Name"].ToString();
                animation.FrameCount = (short)reader["FrameCount"];
                animation.StayCount = (short)reader["StayCount"];
                animation.Back = (bool)reader["Back"];
                this.AllTileAnimations.AddAnimation(animation);
            }
            connection.Close();
            connection.Open();
            reader = new OleDbCommand("Select * From Biography", connection).ExecuteReader();
            while (reader.Read())
            {
                Biography biography = new Biography();
                biography.ID = (short)reader["ID"];
                biography.Brief = reader["Brief"].ToString();
                biography.Romance = reader["Romance"].ToString();
                biography.History = reader["History"].ToString();
                biography.FactionColor = (short)reader["FactionColor"];
                biography.MilitaryKinds.LoadFromString(this.AllMilitaryKinds, reader["MilitaryKinds"].ToString());
                this.AllBiographies.AddBiography(biography);
            }
            connection.Close();

            connection.Open();
            try
            {
                reader = new OleDbCommand("Select * From TextMessageMap", connection).ExecuteReader();
                while (reader.Read())
                {
                    int pid = (short)reader["Person"];
                    TextMessageKind kind = (TextMessageKind) (short) reader["Kind"];
                    List<string> messages = new List<string>();
                    StaticMethods.LoadFromString(messages, reader["Messages"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, kind, messages);
                }
            }
            catch
            {
                reader = new OleDbCommand("Select * From TextMessage", connection).ExecuteReader();
                while (reader.Read())
                {
                    int pid = (short)reader["ID"];

                    List<string> messages = new List<string>();
                    StaticMethods.LoadFromString(messages, reader["CriticalStrike"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.Critical, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["CriticalStrikeOnArchitecture"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.CriticalArchitecture, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["ReceiveCriticalStrike"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.BeCritical, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["Surround"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.Surround, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["Rout"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.Rout, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["DualInitiativeWin"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.DualActiveWin, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["DualPassiveWin"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.DualPassiveWin, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["ControversyInitiativeWin"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.ControversyActiveWin, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["ControversyPassiveWin"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.ControversyPassiveWin, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["Chaos"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.Chaos, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["DeepChaos"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.DeepChaos, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["CastDeepChaos"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.CastDeepChaos, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["RecoverFromChaos"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.RecoverChaos, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["TrappedByStratagem"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.TrappedByStratagem, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["HelpedByStratagem"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.HelpedByStratagem, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["ResistHarmfulStratagem"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.ResistHarmfulStratagem, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["ResistHelpfulStratagem"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.ResistHelpfulStratagem, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["AntiAttack"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.AntiAttack, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["BreakWall"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.BreakWall, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["OutburstAngry"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.Angry, messages);

                    messages.Clear();
                    StaticMethods.LoadFromString(messages, reader["OutburstQuiet"].ToString());
                    this.AllTextMessages.AddTextMessages(pid, TextMessageKind.Calm, messages);
                }
            }
            connection.Close();

            connection.Open();
            try
            {
                reader = new OleDbCommand("Select * From BiographyAdjectives", connection).ExecuteReader();
                while (reader.Read())
                {
                    int t;
                    BiographyAdjectives b = new BiographyAdjectives();
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Strength"].ToString(), out t);
                    b.Strength = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Command"].ToString(), out t);
                    b.Command = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Intelligence"].ToString(), out t);
                    b.Intelligence = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Politics"].ToString(), out t);
                    b.Politics = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Glamour"].ToString(), out t);
                    b.Glamour = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Braveness"].ToString(), out t);
                    b.Braveness = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Calmness"].ToString(), out t);
                    b.Calmness = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["PersonalLoyalty"].ToString(), out t);
                    b.PersonalLoyalty = t;
                    b.ID = (short)reader["ID"];
                    int.TryParse(reader["Ambition"].ToString(), out t);
                    b.Ambition = t;
                    b.Male = (bool)reader["Male"];
                    b.Female = (bool)reader["Female"];
                    StaticMethods.LoadFromString(b.Text, reader["BioText"].ToString());
                    StaticMethods.LoadFromString(b.SuffixText, reader["SuffixText"].ToString());
                    this.AllBiographyAdjectives.Add(b);
                }
            }
            catch
            {
            }
            connection.Close();

            return true;
        }
Beispiel #9
0
 public void RefreshWithPersonList(GameObjectList personList)
 {
     Point position = this.Position;
     Point destination = this.Destination;
     Point realDestination = this.RealDestination;
     Architecture startingArchitecture = this.StartingArchitecture;
     int iD = base.ID;
     Person leader = this.Leader;
     Stunt currentStunt = this.CurrentStunt;
     int stuntDayLeft = this.StuntDayLeft;
     this.Destroy();
     this.Destroyed = false;
     this.realDestination = realDestination;
     this.destination = destination;
     this.position = position;
     this.StartingArchitecture = startingArchitecture;
     base.ID = iD;
     this.Persons.Clear();
     if (!personList.HasGameObject(leader))
     {
         if (personList.Count > 1)
         {
             personList.PropertyName = "FightingForce";
             personList.IsNumber = true;
             personList.ReSort();
         }
         this.Leader = personList[0] as Person;
     }
     foreach (Person person2 in personList)
     {
         this.AddPerson(person2);
     }
     this.Persons.ApplyInfluences();
     if ((currentStunt != null) && (stuntDayLeft > 0))
     {
         this.CurrentStunt = currentStunt;
         this.StuntDayLeft = stuntDayLeft;
     }
     this.Initialize();
 }
Beispiel #10
0
 public void DoStudyStunt()
 {
     this.OutsideTask = OutsideTaskKind.无;
     if (this.StudyingStunt != null)
     {
         if (GameObject.Chance(0x4b))
         {
             this.Stunts.AddStunt(this.StudyingStunt);
             if (this.OnStudyStuntFinished != null)
             {
                 this.OnStudyStuntFinished(this, this.StudyingStunt, true);
             }
         }
         else if (this.OnStudyStuntFinished != null)
         {
             this.OnStudyStuntFinished(this, this.StudyingStunt, false);
         }
         this.StudyingStunt = null;
     }
 }
Beispiel #11
0
 public virtual void PersonStudyStuntFinished(Person person, Stunt stunt, bool success)
 {
 }
 private void troop_OnApplyStunt(Troop troop, Stunt stunt)
 {
     troop.Scenario.GameScreen.TroopApplyStunt(troop, stunt);
 }
 public override void PersonStudyStuntFinished(Person person, Stunt stunt, bool success)
 {
     if (((base.Scenario.CurrentPlayer == null) || base.Scenario.IsCurrentPlayer(person.BelongedFaction)) || GlobalVariables.SkyEye)
     {
         person.TextDestinationString = stunt.Name;
         this.Plugins.tupianwenziPlugin.SetPosition(ShowPosition.Bottom);
         if (success)
         {
             this.Plugins.tupianwenziPlugin.SetGameObjectBranch(person, person, "PersonStudyStuntSuccess");
         }
         else
         {
             this.Plugins.tupianwenziPlugin.SetGameObjectBranch(person, person, "PersonStudyStuntFailed");
         }
         this.Plugins.tupianwenziPlugin.IsShowing = true;
     }
 }
Beispiel #14
0
 public void GoForStudyStunt(Stunt desStunt)
 {
     if (this.LocationArchitecture != null && this.Status == PersonStatus.Normal)
     {
         this.OutsideTask = OutsideTaskKind.特技;
         this.StudyingStunt = desStunt;
         this.TargetArchitecture = this.LocationArchitecture;
         this.ArrivingDays = Math.Max(1, Parameters.LearnStuntDays);
         this.Status = PersonStatus.Moving;
         this.TaskDays = this.ArrivingDays;
         ExtensionInterface.call("GoForStudyStunt", new Object[] { this.Scenario, this });
     }
 }
Beispiel #15
0
 public void DoStudyStunt()
 {
     this.OutsideTask = OutsideTaskKind.无;
     if (this.StudyingStunt != null)
     {
         if (GameObject.Chance(0x4b))
         {
             this.Stunts.AddStunt(this.StudyingStunt);
             ExtensionInterface.call("StudyStuntSuccess", new Object[] { this.Scenario, this, this.StudyingStunt });
             if (this.OnStudyStuntFinished != null && this.ManualStudy)
             {
                 this.OnStudyStuntFinished(this, this.StudyingStunt, true);
             }
         }
         else
         {
             ExtensionInterface.call("StudyStuntFail", new Object[] { this.Scenario, this, this.StudyingStunt });
             if (this.OnStudyStuntFinished != null && this.ManualStudy) {
                 this.OnStudyStuntFinished(this, this.StudyingStunt, false);
             }
         }
         this.StudyingStunt = null;
     }
     this.ManualStudy = false;
 }
 public List<string> LoadStunt(OleDbConnection connection, GameScenario scen)
 {
     List<string> errorMsg = new List<string>();
     connection.Open();
     OleDbDataReader reader = new OleDbCommand("Select * From Stunt", connection).ExecuteReader();
     while (reader.Read())
     {
         Stunt stunt = new Stunt();
         stunt.Scenario = scen;
         stunt.ID = (short)reader["ID"];
         stunt.Name = reader["Name"].ToString();
         stunt.Combativity = (short)reader["Combativity"];
         stunt.Period = (short)reader["Period"];
         stunt.Animation = (short)reader["Animation"];
         List<string> e = stunt.Influences.LoadFromString(this.AllInfluences, reader["Influences"].ToString());
         e.AddRange(stunt.CastConditions.LoadFromString(this.AllConditions, reader["CastConditions"].ToString()));
         e.AddRange(stunt.LearnConditions.LoadFromString(this.AllConditions, reader["LearnConditions"].ToString()));
         e.AddRange(stunt.AIConditions.LoadFromString(this.AllConditions, reader["AIConditions"].ToString()));
         if (e.Count > 0)
         {
             errorMsg.Add("特技ID" + stunt.ID);
             errorMsg.AddRange(e);
         }
         stunt.GenerationChance[0] = (int)reader["General"];
         stunt.GenerationChance[1] = (int)reader["Brave"];
         stunt.GenerationChance[2] = (int)reader["Advisor"];
         stunt.GenerationChance[3] = (int)reader["Politician"];
         stunt.GenerationChance[4] = (int)reader["IntelGeneral"];
         stunt.GenerationChance[5] = (int)reader["Emperor"];
         stunt.GenerationChance[6] = (int)reader["AllRounder"];
         stunt.GenerationChance[7] = (int)reader["Normal"];
         stunt.GenerationChance[8] = (int)reader["Cheap"];
         try
         {
             stunt.GenerationChance[9] = (int)reader["Normal2"];
         }
         catch
         {
             stunt.GenerationChance[9] = stunt.GenerationChance[7];
         }
         stunt.RelatedAbility = (int)reader["Ability"];
         this.AllStunts.AddStunt(stunt);
     }
     connection.Close();
     return errorMsg;
 }
 public override void TroopApplyStunt(Troop troop, Stunt stunt)
 {
     if (((base.Scenario.CurrentPlayer == null) || base.Scenario.CurrentPlayer.IsPositionKnown(troop.Position)) || GlobalVariables.SkyEye)
     {
         if (troop.BelongedFaction != null)
         {
             troop.Leader.TextDestinationString = stunt.Name;
             this.Plugins.PersonBubblePlugin.AddPerson(troop.Leader, troop.Position, TextMessageKind.UseStunt, "ApplyStunt");
         }
         else
         {
             this.Plugins.PersonBubblePlugin.AddPerson(troop.Leader, troop.Position, TextMessageKind.UseStunt, "ApplyStuntBasic");
         }
     }
 }
Beispiel #18
0
        public void DayEvent()
        {
            if (!GameObject.Chance(this.chanceTirednessStopIncrease))
            {
                this.Army.Tiredness += GlobalVariables.TirednessIncrease;
            }
            foreach (Person p in this.Persons)
            {
                if (!GameObject.Chance(p.chanceTirednessStopIncrease) && !GameObject.Chance(this.chanceTirednessStopIncrease))
                {
                    p.Tiredness += GlobalVariables.TirednessIncrease;
                }
            }

            if (this.BelongedFaction != null)
            {
                this.ViewingWillArchitecture = this.IsViewingWillArchitecture();
                this.ContactingWillArchitecture = this.IsContactingWillArchitecture();
                this.OffencingWillArchitecture = this.IsOffencingWillArchitecture();
                this.ContactHostileTroopCount = this.GetContactHostileTroops().Count;
                this.ContactFriendlyTroopCount = this.GetContactFriendlyTroops().Count;
                this.SetFriendlyTroopsInView();
                this.SetHostileTroopsInView();
            }
            if (this.StartingArchitecture != null)
            {
            }
            if ((this.IncrementPerDayOfCombativity + this.CombativityIncrementPerDayByViewArea) > 0)
            {
                this.IncreaseCombativity(this.IncrementPerDayOfCombativity + this.CombativityIncrementPerDayByViewArea);
            }
            if ((this.DecrementPerDayOfCombativity + this.CombativityDecrementPerDayByViewArea) > 0)
            {
                this.DecreaseCombativity(this.DecrementPerDayOfCombativity + this.CombativityDecrementPerDayByViewArea);
            }
            if ((this.InjuryRecoveryPerDayRate > 0f) && (this.InjuryQuantity > 0))
            {
                int number = this.Army.Recovery(this.InjuryRecoveryPerDayRate);
                if (number > 0)
                {
                    this.RefreshOffence();
                    this.RefreshDefence();
                    this.IncrementNumberList.AddNumber(number, CombatNumberKind.人数, this.Position);
                    this.ShowNumber = true;
                }
            }
            if (this.ChaosDayLeft > 0)
            {
                this.ChaosDayLeft--;
                if ((this.ChaosDayLeft == 0) || this.StuntRecoverFromChaos)
                {
                    this.SetRecoverFromChaos();
                }
            }
            if (base.Scenario.FireTable.HasPosition(this.Position))
            {
                this.SetOnFire(Parameters.FireDamageScale * base.Scenario.GetTerrainDetailByPositionNoCheck(this.Position).FireDamageRate);
            }
            if (this.CutRoutewayDays > 0)
            {
                this.CutRoutewayDays--;
                if (this.CutRoutewayDays == 0)
                {
                    this.CutPositionRouteway();
                }
                else if (this.CheckPositionRouteway())
                {
                    this.Controllable = false;
                    this.Operated = true;
                }
                else
                {
                    this.CutRoutewayDays = 0;
                    if (this.OnEndCutRouteway != null)
                    {
                        this.OnEndCutRouteway(this, false);
                    }
                }
            }
            if (this.Food >= this.FoodCostPerDay)
            {
                this.Food -= this.FoodCostPerDay;
                this.RefillFood();

            }
            else
            {
                this.RefillFood();

                if (this.Food < this.FoodCostPerDay)
                {
                    this.Food = 0;
                    if (this.RecentlyFighting > 0)
                    {
                        this.DecreaseCombativity(10);
                        this.DecreaseMorale((int)(10f * this.MoraleChangeRateOnOutOfFood));
                    }
                    else
                    {
                        this.DecreaseCombativity(5);
                        this.DecreaseMorale(5);
                    }
                    CheckTroopRout(this);
                }
                else
                {
                    this.Food -= this.FoodCostPerDay;
                }
            }
            if (this.BelongedFaction != null)
            {
                foreach (TroopEvent event2 in base.Scenario.TroopEvents.GetList())
                {
                    if (event2.CheckTroop(this))
                    {
                        TroopList list = null;
                        if (base.Scenario.TroopEventsToApply.TryGetValue(event2, out list))
                        {
                            list.Add(this);
                        }
                        else
                        {
                            list = new TroopList();
                            list.Add(this);
                            base.Scenario.TroopEventsToApply.Add(event2, list);
                        }
                        event2.ApplyEventDialogs(this);
                    }
                }
            }
            if ((this.CurrentStunt != null) && (this.StuntDayLeft > 0))
            {
                this.StuntDayLeft--;
                if (this.StuntDayLeft == 0)
                {
                    this.CurrentStunt.Purify(this);
                    this.CurrentStunt = null;
                    this.RefreshAllData();
                }
            }

            if (base.Scenario.IsPlayer(this.BelongedFaction) && this.TargetTroop == null && this.TargetArchitecture == null
                && this.Position.Equals(this.Destination)
                && this.Status == TroopStatus.一般 && this.WillArchitecture == this.StartingArchitecture
                && !this.HasHostileTroopInView() && !this.HasHostileArchitectureInView()
                && this.mingling != "移动" && this.mingling != "待命")
            {
                this.minglingweizhi = this.Destination = base.Scenario.GetClosestPoint(this.StartingArchitecture.ArchitectureArea, this.Position);
                this.mingling = "入城";
                this.TargetArchitecture = this.StartingArchitecture;
            }

            this.ResetDayInfluence();
        }
Beispiel #19
0
 public virtual void TroopApplyStunt(Troop troop, Stunt stunt)
 {
 }
Beispiel #20
0
 public void DayEvent()
 {
     if (this.BelongedFaction != null)
     {
         this.ViewingWillArchitecture = this.IsViewingWillArchitecture();
         this.ContactingWillArchitecture = this.IsContactingWillArchitecture();
         this.OffencingWillArchitecture = this.IsOffencingWillArchitecture();
         this.ContactHostileTroopCount = this.GetContactHostileTroops().Count;
         this.ContactFriendlyTroopCount = this.GetContactFriendlyTroops().Count;
         this.SetFriendlyTroopsInView();
         this.SetHostileTroopsInView();
     }
     if (this.StartingArchitecture != null)
     {
     }
     if ((this.IncrementPerDayOfCombativity + this.CombativityIncrementPerDayByViewArea) > 0)
     {
         this.IncreaseCombativity(this.IncrementPerDayOfCombativity + this.CombativityIncrementPerDayByViewArea);
     }
     if ((this.DecrementPerDayOfCombativity + this.CombativityDecrementPerDayByViewArea) > 0)
     {
         this.DecreaseCombativity(this.DecrementPerDayOfCombativity + this.CombativityDecrementPerDayByViewArea);
     }
     if ((this.InjuryRecoveryPerDayRate > 0f) && (this.InjuryQuantity > 0))
     {
         int number = this.Army.Recovery(this.InjuryRecoveryPerDayRate);
         if (number > 0)
         {
             this.RefreshOffence();
             this.RefreshDefence();
             this.IncrementNumberList.AddNumber(number, CombatNumberKind.人数, this.Position);
             this.ShowNumber = true;
         }
     }
     if (this.ChaosDayLeft > 0)
     {
         this.ChaosDayLeft--;
         if ((this.ChaosDayLeft == 0) || this.StuntRecoverFromChaos)
         {
             this.SetRecoverFromChaos();
         }
     }
     if (base.Scenario.FireTable.HasPosition(this.Position))
     {
         this.SetOnFire(Parameters.FireDamageScale * base.Scenario.GetTerrainDetailByPositionNoCheck(this.Position).FireDamageRate);
     }
     if (this.CutRoutewayDays > 0)
     {
         this.CutRoutewayDays--;
         if (this.CutRoutewayDays == 0)
         {
             this.CutPositionRouteway();
         }
         else if (this.CheckPositionRouteway())
         {
             this.Controllable = false;
             this.Operated = true;
         }
         else
         {
             this.CutRoutewayDays = 0;
             if (this.OnEndCutRouteway != null)
             {
                 this.OnEndCutRouteway(this, false);
             }
         }
     }
     if (this.Food >= this.FoodCostPerDay)
     {
         this.Food -= this.FoodCostPerDay;
         this.RefillFoodByArchitecture();
         this.RefillFoodByRouteway();
     }
     else
     {
         this.RefillFoodByArchitecture();
         this.RefillFoodByRouteway();
         if (this.Food < this.FoodCostPerDay)
         {
             this.Food = 0;
             if (this.RecentlyFighting > 0)
             {
                 this.DecreaseCombativity(10);
                 this.DecreaseMorale((int) (10f * this.MoraleChangeRateOnOutOfFood));
             }
             else
             {
                 this.DecreaseCombativity(5);
                 this.DecreaseMorale(5);
             }
             CheckTroopRout(this);
         }
         else
         {
             this.Food -= this.FoodCostPerDay;
         }
     }
     if (this.BelongedFaction != null)
     {
         foreach (TroopEvent event2 in base.Scenario.TroopEvents.GetRandomList())
         {
             if (event2.CheckTroop(this))
             {
                 event2.ApplyEventDialogs(this);
                 TroopList list = null;
                 if (base.Scenario.TroopEventsToApply.TryGetValue(event2, out list))
                 {
                     list.Add(this);
                 }
                 else
                 {
                     list = new TroopList();
                     list.Add(this);
                     base.Scenario.TroopEventsToApply.Add(event2, list);
                 }
             }
         }
     }
     if ((this.CurrentStunt != null) && (this.StuntDayLeft > 0))
     {
         this.StuntDayLeft--;
         if (this.StuntDayLeft == 0)
         {
             this.CurrentStunt.Purify(this);
             this.CurrentStunt = null;
             this.RefreshAllData();
         }
     }
     this.ResetDayInfluence();
 }
Beispiel #21
0
 public void GoForStudyStunt(Stunt desStunt)
 {
     if (this.LocationArchitecture != null)
     {
         this.OutsideTask = OutsideTaskKind.特技;
         this.StudyingStunt = desStunt;
         this.TargetArchitecture = this.LocationArchitecture;
         this.ArrivingDays = Parameters.LearnStuntDays;
         this.TargetArchitecture.RemovePerson(this);
         this.TargetArchitecture.MovingPersons.Add(this);
         this.TaskDays = this.ArrivingDays;
     }
 }
Beispiel #22
0
 private void PostActionAI()
 {
     if (((((!this.HasSupply || !GameObject.Chance(0x21)) && this.ControlAvail()) && ((this.RationDaysLeft == 0) || ((this.RationDaysLeft == 1) && GameObject.Chance(20)))) && this.LevyFoodAvail()) && (GameObject.Chance(50) || !this.HasHostileTroopInView()))
     {
         TerrainDetail terrainDetailByPositionNoCheck = base.Scenario.GetTerrainDetailByPositionNoCheck(this.Position);
         if ((terrainDetailByPositionNoCheck != null) && (terrainDetailByPositionNoCheck.GetFood(base.Scenario.Date.Season) >= (((this.RationDaysLeft + 1.5) * this.FoodCostPerDay) - this.Food)))
         {
             this.LevyFood();
         }
     }
     if (this.ControlAvail() && ((this.Stunts.Count > 0) && (this.CurrentStunt == null)))
     {
         foreach (Stunt stunt in this.Stunts.GetStuntList().GetRandomList())
         {
             if (this.HasStunt(stunt.ID) && stunt.IsAIable(this))
             {
                 this.CurrentStunt = stunt;
                 this.ApplyCurrentStunt();
                 break;
             }
         }
     }
 }