// 武将1は武将2に対する命令権を有するか? public bool CheckHaveControl(Busyo busyo1, Busyo busyo2) { // 返却値の宣言 bool ret = false; // 武将1と武将2は同一人物か? if (busyo1 == busyo2) ret = true; // 武将1が格上? else if (this.CheckPost(busyo1, busyo2) > 0) { switch (busyo1.Post) { // 君主又は軍師の場合 case Post.ForceHead: case Post.ForceDeputy: // 同一勢力か? if (busyo1.Force == busyo2.Force) ret = true; break; // 軍団長又は副官の場合 case Post.CorpsOfficer: case Post.CorpsAdjutant: // 同一軍団か? if (busyo1.Corps == busyo2.Corps) ret = true; break; // 連隊長又は副官の場合 case Post.RegimentOfficer: case Post.RegimentAdjutant: // 同一連隊か? if (busyo1.Regiment == busyo2.Regiment) ret = true; break; } } // 返却値を返す return ret; } // 武将の役職の上下関係を判定する public int CheckPost(Busyo busyo1, Busyo busyo2) { if (busyo1.Post < busyo2.Post) return -1; else if (busyo1.Post > busyo2.Post) return 1; else return 0; }