All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
unblockableCheck.h
Go to the documentation of this file.
1 /* unblockableCheck.h
2  */
3 #ifndef _UNBLOCKABLECHECK_H
4 #define _UNBLOCKABLECHECK_H
5 
7 namespace osl
8 {
9  namespace effect_util
10  {
11 
13  {
21  static bool isMember(Player target, const NumEffectState& state)
22  {
23  const Square king_position = state.kingSquare(target);
24  Piece attacker_piece;
25  if (state.hasEffectAt(alt(target), king_position, attacker_piece))
26  {
27  if (attacker_piece == Piece::EMPTY())
28  return true; // multiple pieces
29 
30  // sigle check
31  const Square from = attacker_piece.square();
32  const EffectContent effect
33  = Ptype_Table.getEffect(attacker_piece.ptypeO(),
34  from, king_position);
35  return effect.hasUnblockableEffect();
36  }
37  // no check
38  return false;
39  }
40  };
41 
42  } // namespace effect_util
43 } // namespace osl
44 
45 #endif /* _UNBLOCKABLECHECK_H */
46 // ;;; Local Variables:
47 // ;;; mode:c++
48 // ;;; c-basic-offset:2
49 // ;;; End: