public void flagTest() { PileFlag flag = PileFlag.self | PileFlag.hand | PileFlag.field; Assert.True(flag.HasFlag(PileFlag.self)); Assert.False(flag.HasFlag(PileFlag.oppo)); Assert.True(flag.HasFlag(PileFlag.hand)); Assert.True(flag.HasFlag(PileFlag.field)); flag |= PileFlag.both; Assert.True(flag.HasFlag(PileFlag.oppo)); }
public static Pile[] getPiles(this PileFlag flag, THHGame game, Player player) { List <Pile> pileList = new List <Pile>(); if (flag.HasFlag(PileFlag.self)) { addPileToList(player, flag, pileList); } if (flag.HasFlag(PileFlag.oppo)) { player = game.getOpponent(player); addPileToList(player, flag, pileList); } return(pileList.ToArray()); }
public static string[] getPiles(this PileFlag flag) { List <string> pileList = new List <string>(); if (flag.HasFlag(PileFlag.master)) { pileList.Add(MASTER); } if (flag.HasFlag(PileFlag.init)) { pileList.Add(INIT); } if (flag.HasFlag(PileFlag.hand)) { pileList.Add(HAND); } if (flag.HasFlag(PileFlag.skill)) { pileList.Add(SKILL); } if (flag.HasFlag(PileFlag.deck)) { pileList.Add(DECK); } if (flag.HasFlag(PileFlag.field)) { pileList.Add(FIELD); } if (flag.HasFlag(PileFlag.grave)) { pileList.Add(GRAVE); } if (flag.HasFlag(PileFlag.warp)) { pileList.Add(WARP); } if (flag.HasFlag(PileFlag.item)) { pileList.Add(ITEM); } return(pileList.ToArray()); }
private static void addPileToList(Player player, PileFlag flag, List <Pile> pileList) { if (flag.HasFlag(PileFlag.master)) { pileList.Add(player[MASTER]); } if (flag.HasFlag(PileFlag.init)) { pileList.Add(player[INIT]); } if (flag.HasFlag(PileFlag.hand)) { pileList.Add(player[HAND]); } if (flag.HasFlag(PileFlag.skill)) { pileList.Add(player[SKILL]); } if (flag.HasFlag(PileFlag.deck)) { pileList.Add(player[DECK]); } if (flag.HasFlag(PileFlag.field)) { pileList.Add(player[FIELD]); } if (flag.HasFlag(PileFlag.grave)) { pileList.Add(player[GRAVE]); } if (flag.HasFlag(PileFlag.warp)) { pileList.Add(player[WARP]); } if (flag.HasFlag(PileFlag.item)) { pileList.Add(player[ITEM]); } }