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; if (tmp == current) return findrules; Tile rejected = tmp.GetRejected(); if (rejected == null) return findrules; 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 == 2) findrules.Add(rulepos); } } return findrules; }
private Tile GetTile(PlayerData p, Tile.Family f, int pos) { Group g = p.GetHand(); for (int i = 0; i < g.Count; i++) { if ((g[i].GetFamily() == f) && (g[i].GetNumber() == pos)) return g[i]; } return null; }
private bool HaveTile(PlayerData p, Tile.Family f, int pos) { Group g = p.GetHand(); for (int i = 0; i < g.Count; i++) { if ((g[i].GetFamily() == f) && (g[i].GetNumber() == pos)) return true; } return false; }