} //移动 public int active_Visit(uint seer_id, uint person_id) { lc_Seer seer = GetObject <lc_Seer>(seer_id); uint rel_id = GetRelShip <STU_PEO_REL>(seer_id).rel_id; lc_Religion rel = GetObject <lc_Religion>(rel_id); lc_Personality person = GetObject <lc_Personality>(person_id); int chgnum = seer.m_eloquence * 2 - person.m_risist; if (chgnum <= 0) { return(5); /*转变程度小于0*/ } if (GetRelShip <STU_PEO_REL>(person_id).rel_id == DEFREL) { int ret = SetPeoRel(person.obj_id, rel.obj_id, chgnum); if (ret == 3) { return(3); /*增加该人物转变*/ } else if (ret == 4) { return(4); /*成功转变该人物*/ } else { return(-1); /*逻辑错误*/ } } else { return(2); /*该人物已信仰其他宗教*/ } } //拜访
/*设置对象数值*/ /*变量修改操作*/ //public uint AddVarChange(lc_VarChange.objType sourceType, uint source_id, int setTime, int RunType, int TypeParam, // lc_VarChange.objType eventTag, uint tag_id, matchVarChg[] invarchg) { // return objgather.AddVarChange(sourceType, source_id, setTime, RunType, TypeParam, eventTag, tag_id, invarchg); //} //新增变量修改 //public void DelVarChange(uint event_id) { // objgather.DelVarChange(event_id); //} //删除变量修改 //public int ExecVarChange(int nowtime) { // return objgather.ExecVarChange(nowtime); //} //执行变量修改 //事件 //public void AddEvent(uint event_id, string event_name, int judge_type) { // objgather.AddEvent(event_id, event_name, judge_type); //} //public void AddTrigger(uint event_id, lc_Object.GAMEOBJTYPE obj_type, int scope, string varname, int cond_type, int varvalue) { // objgather.AddTrigger(event_id, obj_type, scope, varname, cond_type, varvalue); //} //public void AddTrigger(uint event_id, uint triggerEvent_id) { // objgather.AddTrigger(event_id, triggerEvent_id); //} //public void showEvent() { // objgather.ShowEvent(); //} //对象附加规则操作 public int RelAddCanon(uint rel_id, uint canon_id) /*新增教规*/ { lc_Religion rel = GetObject <lc_Religion>(rel_id); lc_Canon canon = GetObject <lc_Canon>(canon_id); if (rel != null && canon != null) { if (rel.m_theorypt < canon.m_cost) { return(0); //理论点数不足 } else { rel.m_theorypt -= canon.m_cost; rel.RelAddCanon(canon); return(1); } //matchVarChg[] varchgarray = new matchVarChg[canon.chglist.Count]; //for( int i = 0; i < varchgarray.Length; i++) { // varchgarray[i] = new matchVarChg(canon.chglist[i].instruction, canon.chglist[i].varname, canon.chglist[i].chgnum, canon.chglist[i].instruction, canon.chglist[i].varname, -canon.chglist[i].chgnum); //} //uint event_id =objgather.AddVarChange(lc_VarChange.objType.CANON,canon_id,NowRound(),2,0,lc_VarChange.objType.RELIGION,rel_id,varchgarray); //rel.relAddCanon(canon_id, event_id); //objgather.ExecVarChange(1); /*立即轮询一次事件*/ //return 1; } else { return(-1); /*逻辑错误*/ } } /*宗教新增规则*/
} //修建建筑 public int active_Meditation(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); int chgnum = seer.m_intelligence; rel.m_theorypt += chgnum; return(1); } //冥思
}//构造函数 public lc_Religion(lc_Religion srcTag) : base(srcTag) { this.build_date = srcTag.build_date; this.m_relType = srcTag.m_relType; this.m_attraction = srcTag.m_attraction; this.m_piety = srcTag.m_piety; this.m_organization = srcTag.m_organization; this.m_theorypt = srcTag.m_theorypt; this.leader_id = srcTag.leader_id; //listCanonEvent = new List<CanonEvent>(); //for( int i =0; i < srcTag.listCanonEvent.Count; i++) { // CanonEvent newcanonevent = new CanonEvent(srcTag.listCanonEvent[i].canon_id, srcTag.listCanonEvent[i].event_id); // listCanonEvent.Add(newcanonevent); //} listCanon = new List <uint>(srcTag.listCanon.ToArray()); }//拷贝构造函数
} /*宗教新增规则*/ public int RelDelCanon(uint rel_id, uint canon_id) /*删除教规*/ { lc_Religion rel = GetObject <lc_Religion>(rel_id); lc_Canon canon = GetObject <lc_Canon>(rel_id); if (rel != null && canon != null) { rel.RelDelCanon(canon); return(1); //int index = rel.listCanonEvent.FindIndex(delegate (CanonEvent temp) { return temp.canon_id == canon_id; }); //if (index == -1) return -1; /*逻辑错误*/ //else { // objgather.DelVarChange(rel.listCanonEvent[index].event_id); // rel.listCanonEvent.RemoveAt(index); // return 1; //} } else { return(-1); /*逻辑错误*/ } } /*宗教删除规则*/
//玩家行为 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); } //传教