Пример #1
0
        } //拜访

        public int active_Build(uint peo_id, uint building_id)
        {
            lc_Seer seer    = GetObject <lc_Seer>(peo_id);
            uint    city_id = GetRelShip <STU_PEO_CITY>(peo_id).city_id;
            lc_City city    = GetObject <lc_City>(city_id);
            int     ret     = CityAddBuilding(city.obj_id, seer.obj_id, building_id);

            return(ret);
        } //修建建筑
Пример #2
0
        } /*宗教删除规则*/

        public int CityAddBuilding(uint city_id, uint peo_id, uint building_id)
        {
            uint        rel_belong;
            uint        obj_id;
            int         index    = lc_ObjGather.GetRelNameMap("STU_CITY_BUILDING");
            lc_City     city     = GetObject <lc_City>(city_id);
            lc_Building building = GetObject <lc_Building>(building_id);
            lc_Seer     seer     = GetObject <lc_Seer>(peo_id);

            if (peo_id != 0)
            {
                if (seer.m_wealth < building.m_cost)
                {
                    return(0);
                }
                seer.m_wealth -= building.m_cost;
            }

            if (building.m_belong)
            {
                STU_PEO_REL stu_peo_rel = GetRelShip <STU_PEO_REL>(peo_id);
                rel_belong = stu_peo_rel.rel_id;
            }
            else
            {
                rel_belong = 0;
            }

            STU_CITY_BUILDING stu_city_build = new STU_CITY_BUILDING(city_id, building.obj_id, rel_belong);

            objgather.relship_list[index].Add(stu_city_build);

            foreach (var chgnum in building.chglist)
            {
                int typeindex = lc_ObjGather.GetObjNameMap(chgnum.objtype);
                switch (chgnum.objtype)
                {
                case "BUILDING":
                    obj_id = building.obj_id;
                    break;

                case "RELIGION":
                    obj_id = stu_city_build.rel_belong_id;
                    break;

                default:
                    return(-1);
                }

                lc_Object obj = objgather.obj_list[typeindex].Find(delegate(lc_Object temp) { return(temp.obj_id == obj_id); });
                obj.ChangeVar <int>(chgnum.varname, chgnum.chgnum);
            }

            return(1);
        } /*城市增加建筑*/
Пример #3
0
        } /*城市增加建筑*/

        public int CityDelBuilding(uint city_id, uint building_id)
        {
            uint        obj_id;
            int         typeint  = lc_ObjGather.GetRelNameMap("STU_CITY_BUILDING");
            lc_City     city     = GetObject <lc_City>(city_id);
            lc_Building building = GetObject <lc_Building>(building_id);

            if (city != null && building != null)
            {
                List <STU_CITY_BUILDING> stulist = objgather.GetAllRelShip <STU_CITY_BUILDING>(city_id);
                int index = stulist.FindIndex(delegate(STU_CITY_BUILDING temp) { return(temp.building_id == building_id); });
                if (index == -1)
                {
                    return(-1);
                }
                else
                {
                    foreach (var chgnum in building.chglist)
                    {
                        int typeindex = lc_ObjGather.GetObjNameMap(chgnum.objtype);
                        switch (chgnum.objtype)
                        {
                        case "BUILDING":
                            obj_id = building.obj_id;
                            break;

                        case "RELIGION":
                            obj_id = stulist[index].rel_belong_id;
                            break;

                        default:
                            return(-1);
                        }
                        lc_Object obj = objgather.obj_list[typeindex].Find(delegate(lc_Object temp) { return(temp.obj_id == obj_id); });
                        obj.ChangeVar <int>(chgnum.varname, -chgnum.chgnum);
                        stulist.RemoveAt(index);
                    }

                    return(1);
                }
            }
            else
            {
                return(-1);/*逻辑错误*/
            }
        }/*城市删除建筑*/
Пример #4
0
        //玩家行为
        public int active_Preach(uint peo_id)
        {
            lc_Seer     seer           = GetObject <lc_Seer>(peo_id);
            uint        rel_id         = GetRelShip <STU_PEO_REL>(peo_id).rel_id;
            lc_Religion rel            = GetObject <lc_Religion>(rel_id);
            uint        city_id        = GetRelShip <STU_PEO_CITY>(peo_id).city_id;
            lc_City     city           = GetObject <lc_City>(city_id);
            uint        country_id     = GetRelShip <STU_CITY_COUNTRY>(city_id).country_id;
            lc_Country  country        = GetObject <lc_Country>(country_id);
            int         city_rel_index = GetRelShip <STU_CITY_INF>(city_id).rel_rat.FindIndex(delegate(SUBSTU_REL_RAT temp) { return(temp.rel_id == DEFREL); });
            int         city_rel_num   = GetRelShip <STU_CITY_INF>(city_id).rel_rat[city_rel_index].rel_num;
            //效果 = 口才*4000+(宗教吸引力-王权)*2000-组织度*1000
            int attr_num = seer.m_eloquence * 4000 + (rel.m_attraction - country.m_crown) * 2000 - rel.m_organization * 1000;

            //减少对应无信仰人数,增加对应宗教人数
            if (attr_num > city_rel_num)
            {
                attr_num = city_rel_num;
            }
            SetCityRel(city.obj_id, DEFREL, -attr_num);
            SetCityRel(city.obj_id, rel.obj_id, attr_num);

            return(1);
        } //传教
Пример #5
0
        }//构造函数

        public lc_City(lc_City srcTag) : base(srcTag)
        {
            this.m_pop = srcTag.m_pop;
            this.m_ems = srcTag.m_ems;
        }//拷贝构造函数