public List <Mahjong.Plugin.IReferee.m_rulepossibility> Execute(List <PlayerData> players, PlayerData current) { m_results.Clear(); List <Mahjong.Plugin.IReferee.m_rulepossibility> findrules = new List <IReferee.m_rulepossibility>(); PlayerData PrevPlayer = GetPreviousPlayer(players, current); Tile ttmp = PrevPlayer.GetRejected(); Group gtmp = current.GetHand().Clone(); if (ttmp != null) { gtmp.Add(ttmp); } RecurMah(gtmp, new GroupType()); AddExposed(current); // Analyse real Mahjong RemoveFalseMahjong(); // Add Mahjong to findrules for (int i = 0; i < m_results.Count; i++) { Mahjong.Plugin.IReferee.m_rulepossibility ins = new IReferee.m_rulepossibility(); ins.Player = current; ins.Rule = this; ins.Group = current.GetHand().Clone(); findrules.Add(ins); } return(findrules); }
public List <Mahjong.Plugin.IReferee.m_rulepossibility> Execute(List <PlayerData> players, PlayerData current) { List <Mahjong.Plugin.IReferee.m_rulepossibility> findrules = new List <IReferee.m_rulepossibility>(); PlayerData PrevPlayer = GetPreviousPlayer(players, current); Tile ttmp = PrevPlayer.GetRejected(); if (ttmp == null) { return(findrules); } if ((ttmp.GetFamily() == Tile.Family.Flower) || (ttmp.GetFamily() == Tile.Family.Season) || (ttmp.GetFamily() == Tile.Family.Wind) || (ttmp.GetFamily() == Tile.Family.Dragon)) { return(findrules); } if ((HaveTile(current, ttmp.GetFamily(), ttmp.GetNumber() - 2)) && (HaveTile(current, ttmp.GetFamily(), ttmp.GetNumber() - 1))) { Mahjong.Plugin.IReferee.m_rulepossibility rulepos = new IReferee.m_rulepossibility(); rulepos.Rule = this; rulepos.Player = current; rulepos.Group = new Group(); rulepos.Group.Add(GetTile(current, ttmp.GetFamily(), ttmp.GetNumber() - 2)); rulepos.Group.Add(GetTile(current, ttmp.GetFamily(), ttmp.GetNumber() - 1)); findrules.Add(rulepos); } if ((HaveTile(current, ttmp.GetFamily(), ttmp.GetNumber() - 1)) && (HaveTile(current, ttmp.GetFamily(), ttmp.GetNumber() + 1))) { Mahjong.Plugin.IReferee.m_rulepossibility rulepos = new IReferee.m_rulepossibility(); rulepos.Rule = this; rulepos.Player = current; rulepos.Group = new Group(); rulepos.Group.Add(GetTile(current, ttmp.GetFamily(), ttmp.GetNumber() - 1)); rulepos.Group.Add(GetTile(current, ttmp.GetFamily(), ttmp.GetNumber() + 1)); findrules.Add(rulepos); } if ((HaveTile(current, ttmp.GetFamily(), ttmp.GetNumber() + 1)) && (HaveTile(current, ttmp.GetFamily(), ttmp.GetNumber() + 2))) { Mahjong.Plugin.IReferee.m_rulepossibility rulepos = new IReferee.m_rulepossibility(); rulepos.Rule = this; rulepos.Player = current; rulepos.Group = new Group(); rulepos.Group.Add(GetTile(current, ttmp.GetFamily(), ttmp.GetNumber() + 1)); rulepos.Group.Add(GetTile(current, ttmp.GetFamily(), ttmp.GetNumber() + 2)); findrules.Add(rulepos); } return(findrules); }
public List <Mahjong.Plugin.IReferee.m_rulepossibility> Execute(List <PlayerData> players, PlayerData current) { List <Mahjong.Plugin.IReferee.m_rulepossibility> findrules = new List <IReferee.m_rulepossibility>(); PlayerData tmp = GetRejectTilePlayer(players); if (tmp == null) { return(findrules); } Tile rejected = tmp.GetRejected(); Group gtmp = current.GetHand(); Mahjong.Plugin.IReferee.m_rulepossibility rulepos = new IReferee.m_rulepossibility(); rulepos.Rule = this; rulepos.Player = current; rulepos.Group = new Group(); for (int i = 0; i < gtmp.Count; i++) { Tile ttmp = gtmp[i]; if ((rejected.GetNumber() == ttmp.GetNumber()) && (rejected.GetFamily() == ttmp.GetFamily())) { rulepos.Group.Add(ttmp); if (rulepos.Group.Count == 3) { findrules.Add(rulepos); } } } for (int y = 0; y < current.GetExposed().Count; y++) { Mahjong.Plugin.IReferee.m_rulepossibility rulepos2 = new IReferee.m_rulepossibility(); rulepos2.Rule = this; rulepos2.Player = current; rulepos2.Group = new Group(); Group etmp = current.GetExposed()[y]; for (int i = 0; i < etmp.Count; i++) { Tile ttmp = etmp[i]; if ((rejected.GetNumber() == ttmp.GetNumber()) && (rejected.GetFamily() == ttmp.GetFamily())) { rulepos2.Group.Add(ttmp); if (rulepos2.Group.Count == 3) { findrules.Add(rulepos2); } } } } return(findrules); }
private bool GetMessageCAL(NetPlayer p, String[] tab, NetMessage msg, ref String DiconnectionReason) { List <Mahjong.Plugin.IReferee.m_rulepossibility> lpos = p.CurrentRoom.GetReferee().GetRulesPossibilities(p); Mahjong.Plugin.IReferee.m_rulepossibility tmp = new IReferee.m_rulepossibility(); tmp.Player = p; tmp.Rule = p.CurrentRoom.GetReferee().GetRuleByName(tab[1]); tmp.Group = new Group(); for (int i = 2; i < tab.Length;) { Tile ins = p.CurrentRoom.GetReferee().GetTile(tab[i], Convert.ToInt32(tab[i + 1])); tmp.Group.Add(ins); i += 2; } //for (int i = 0; i < lpos.Count; i++) //{ // Mahjong.Plugin.IReferee.m_rulepossibility rptmp = lpos[i]; // if (rptmp.Equal(tmp) == true) // { if (p.CurrentRoom.GetReferee().Call(tmp) == true) { //p.Send("CAL:OK"); String netmsg = "CAL:" + p.GetName(); for (int j = 0; j < tmp.Group.Count; j++) { netmsg += ":" + tmp.Group[j].GetFamily() + ":" + tmp.Group[j].GetNumber().ToString(); p.Send("TIL:REMOVE:" + tmp.Group[j].GetFamily() + ":" + tmp.Group[j].GetNumber().ToString()); } p.CurrentRoom.Send(netmsg, null); p.CurrentRoom.Send("TRN:" + p.CurrentRoom.GetReferee().CurrentPlayer().GetName(), null); } else { p.Send("CAL:KO"); } // } // } return(true); }