ShenShaLogic.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. import Common
  2. from LocalModel import BaZi, SiZhuWeiZhi, SiZhu, ShenSha
  3. def check_shenshas(bazi: BaZi):
  4. # 带new的都是按新版本神煞计算的,目前暂时采用的神煞都是新版本计算的
  5. __check_new_yangren(bazi)
  6. # 这里计算的是广义桃花
  7. __check_new_taohua(bazi)
  8. __check_new_yima(bazi)
  9. def __check_new_yangren(bazi: BaZi):
  10. key = "羊刃"
  11. tip = "冲羊刃影响健康"
  12. riyuan = bazi.riGan.text
  13. if riyuan in ["甲", "乙"]:
  14. __fill_data_in_bazi("卯", key, tip, bazi)
  15. elif riyuan in ["丙", "丁"]:
  16. __fill_data_in_bazi("午", key, tip, bazi)
  17. elif riyuan in ["戊", "己"]:
  18. __fill_data_in_bazi("午", key, tip, bazi)
  19. elif riyuan in ["庚", "辛"]:
  20. __fill_data_in_bazi("酉", key, tip, bazi)
  21. elif riyuan in ["壬", "癸"]:
  22. __fill_data_in_bazi("子", key, tip, bazi)
  23. def __check_new_taohua(bazi: BaZi):
  24. key = "桃花"
  25. tip = ""
  26. __fill_data_in_bazi("子", key, tip, bazi)
  27. __fill_data_in_bazi("午", key, tip, bazi)
  28. __fill_data_in_bazi("卯", key, tip, bazi)
  29. __fill_data_in_bazi("酉", key, tip, bazi)
  30. def __check_new_yima(bazi: BaZi):
  31. key = "驿马"
  32. tip = "冲坐支驿马为灾"
  33. __fill_data_in_bazi("申", key, tip, bazi)
  34. __fill_data_in_bazi("寅", key, tip, bazi)
  35. __fill_data_in_bazi("巳", key, tip, bazi)
  36. __fill_data_in_bazi("亥", key, tip, bazi)
  37. def __check_new_kuigang(bazi: BaZi):
  38. key = "魁罡"
  39. texts = [["庚", "辰"], ["戊", "辰"], ["辰", "戌"], ["庚", "辰"]]
  40. zhus = [SiZhuWeiZhi.nianzhu.value, SiZhuWeiZhi.yuezhu.value, SiZhuWeiZhi.rizhu.value, SiZhuWeiZhi.shizhu.value]
  41. for zhu in zhus:
  42. tgdz = bazi.getTianGanDiZhiByZhu(zhu)
  43. # bazi.shenshaInfo.fenbu[wz].append(info)
  44. def __fill_data_in_bazi(key: str, name: str, tip: str, bazi: BaZi):
  45. for sz in bazi.sizhu_dizhis():
  46. if sz.text == key:
  47. wz = Common.get_weizhi_of_zhu(sz.weiZhi)
  48. info = ShenSha(name, tip)
  49. bazi.shenshaInfo.fenbu[wz].append(info)
  50. def __check_tianyiguiren(bazi: BaZi):
  51. key = "天乙贵人"
  52. # dts = Tianyiguiren.select().where(Tianyiguiren.niangan == bazi.nianGan.text)
  53. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  54. # if len(dts) > 0:
  55. # for dt in dts:
  56. # if bazi.nianZhi.text == dt.dizhi:
  57. # wz = SiZhuWeiZhi.nianzhu
  58. # bazi.add_shensha(wz, key, tip)
  59. # if bazi.yueZhi.text == dt.dizhi:
  60. # wz = SiZhuWeiZhi.yuezhu
  61. # bazi.add_shensha(wz, key, tip)
  62. # if bazi.riZhi.text == dt.dizhi:
  63. # wz = SiZhuWeiZhi.rizhu
  64. # bazi.add_shensha(wz, key, tip)
  65. # if bazi.shiZhi.text == dt.dizhi:
  66. # wz = SiZhuWeiZhi.shizhu
  67. # bazi.add_shensha(wz, key, tip)
  68. #
  69. # dts2 = Tianyiguiren.select().where(Tianyiguiren.rigan == bazi.riGan.text)
  70. # if len(dts2) > 0:
  71. # for dt in dts2:
  72. # if bazi.nianZhi.text == dt.dizhi:
  73. # wz = SiZhuWeiZhi.nianzhu
  74. # bazi.add_shensha(wz, key, tip)
  75. # if bazi.yueZhi.text == dt.dizhi:
  76. # wz = SiZhuWeiZhi.yuezhu
  77. # bazi.add_shensha(wz, key, tip)
  78. # if bazi.riZhi.text == dt.dizhi:
  79. # wz = SiZhuWeiZhi.rizhu
  80. # bazi.add_shensha(wz, key, tip)
  81. # if bazi.shiZhi.text == dt.dizhi:
  82. # wz = SiZhuWeiZhi.shizhu
  83. # bazi.add_shensha(wz, key, tip)
  84. def __check_zaisha(bazi: BaZi):
  85. key = "灾煞"
  86. # dts = Zaisha.select().where(Zaisha.nianzhi == bazi.nianZhi.text)
  87. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  88. # if len(dts) > 0:
  89. # for dt in dts:
  90. # if bazi.yueZhi.text == dt.dizhi:
  91. # wz = SiZhuWeiZhi.yuezhu
  92. # dz = SiZhuWeiZhi.yuezhi
  93. # bazi.add_shensha(wz, key, tip, __get_zaisha_effect(bazi, dz))
  94. # if bazi.riZhi.text == dt.dizhi:
  95. # wz = SiZhuWeiZhi.rizhu
  96. # dz = SiZhuWeiZhi.rizhi
  97. # bazi.add_shensha(wz, key, tip, __get_zaisha_effect(bazi, dz))
  98. # if bazi.shiZhi.text == dt.dizhi:
  99. # wz = SiZhuWeiZhi.shizhu
  100. # dz = SiZhuWeiZhi.shizhi
  101. # bazi.add_shensha(wz, key, tip, __get_zaisha_effect(bazi, dz))
  102. # dts2 = Zaisha.select().where(Zaisha.rizhi == bazi.riZhi.text)
  103. # if len(dts2) > 0:
  104. # for dt in dts2:
  105. # wz = SiZhuWeiZhi.unknown
  106. # if bazi.nianZhi.text == dt.dizhi:
  107. # wz = SiZhuWeiZhi.nianzhu
  108. # dz = SiZhuWeiZhi.nianzhi
  109. # bazi.add_shensha(wz, key, tip, __get_zaisha_effect(bazi, dz))
  110. # if bazi.yueZhi.text == dt.dizhi:
  111. # wz = SiZhuWeiZhi.yuezhu
  112. # dz = SiZhuWeiZhi.yuezhi
  113. # bazi.add_shensha(wz, key, tip, __get_zaisha_effect(bazi, dz))
  114. # if bazi.shiZhi.text == dt.dizhi:
  115. # wz = SiZhuWeiZhi.shizhu
  116. # dz = SiZhuWeiZhi.shizhi
  117. # bazi.add_shensha(wz, key, tip, __get_zaisha_effect(bazi, dz))
  118. def __check_wenchangxing(bazi: BaZi):
  119. key = "文昌星"
  120. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  121. # if bazi.nianGan.shiShen == "食":
  122. # dts = Shishenzhilu.select().where(Shishenzhilu.tiangan == bazi.nianGan.text)
  123. # if len(dts) > 0:
  124. # if bazi.nianZhi.text == dts[0].dizhi:
  125. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  126. # if bazi.yueGan.shiShen == "食":
  127. # dts = Shishenzhilu.select().where(Shishenzhilu.tiangan == bazi.yueGan.text)
  128. # if len(dts) > 0:
  129. # if bazi.yueZhi.text == dts[0].dizhi:
  130. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  131. # if bazi.shiGan.shiShen == "食":
  132. # dts = Shishenzhilu.select().where(Shishenzhilu.tiangan == bazi.shiGan.text)
  133. # if len(dts) > 0:
  134. # if bazi.shiZhi.text == dts[0].dizhi:
  135. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  136. def __check_lushen(bazi: BaZi):
  137. key = "禄神"
  138. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  139. # dts1 = Tiangan.select().where(Tiangan.name == bazi.nianGan.text)
  140. # if len(dts1) > 0:
  141. # if bazi.nianZhi.text == dts1[0].linguan:
  142. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  143. # dts2 = Tiangan.select().where(Tiangan.name == bazi.yueGan.text)
  144. # if len(dts2) > 0:
  145. # if bazi.yueZhi.text == dts2[0].linguan:
  146. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  147. # dts3 = Tiangan.select().where(Tiangan.name == bazi.riGan.text)
  148. # if len(dts3) > 0:
  149. # if bazi.riZhi.text == dts3[0].linguan:
  150. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  151. # dts4 = Tiangan.select().where(Tiangan.name == bazi.shiGan.text)
  152. # if len(dts4) > 0:
  153. # if bazi.shiZhi.text == dts4[0].linguan:
  154. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  155. def __check_kuigang(bazi: BaZi):
  156. key = "魁罡"
  157. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  158. # if bazi.nianGan.text == "庚" and bazi.nianZhi.text == "戌":
  159. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  160. # if bazi.nianGan.text == "庚" and bazi.nianZhi.text == "辰":
  161. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  162. # if bazi.nianGan.text == "戊" and bazi.nianZhi.text == "戌":
  163. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  164. # if bazi.nianGan.text == "壬" and bazi.nianZhi.text == "辰":
  165. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  166. #
  167. # if bazi.yueGan.text == "庚" and bazi.yueZhi.text == "戌":
  168. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  169. # if bazi.yueGan.text == "庚" and bazi.yueZhi.text == "辰":
  170. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  171. # if bazi.yueGan.text == "戊" and bazi.yueZhi.text == "戌":
  172. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  173. # if bazi.yueGan.text == "壬" and bazi.yueZhi.text == "辰":
  174. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  175. #
  176. # if bazi.riGan.text == "庚" and bazi.riZhi.text == "戌":
  177. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  178. # if bazi.riGan.text == "庚" and bazi.riZhi.text == "辰":
  179. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  180. # if bazi.riGan.text == "戊" and bazi.riZhi.text == "戌":
  181. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  182. # if bazi.riGan.text == "壬" and bazi.riZhi.text == "辰":
  183. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  184. #
  185. # if bazi.shiGan.text == "庚" and bazi.shiZhi.text == "戌":
  186. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  187. # if bazi.shiGan.text == "庚" and bazi.shiZhi.text == "辰":
  188. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  189. # if bazi.shiGan.text == "戊" and bazi.shiZhi.text == "戌":
  190. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  191. # if bazi.shiGan.text == "壬" and bazi.shiZhi.text == "辰":
  192. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  193. def __check_dashe(bazi: BaZi):
  194. key = "大赦"
  195. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  196. # dts = Dashe.select().where(Dashe.rigan == bazi.riGan.text)
  197. # if len(dts) > 0:
  198. # if bazi.nianGan.text == dts[0].tiangan and bazi.nianZhi.text == dts[0].dizhi:
  199. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  200. # if bazi.yueGan.text == dts[0].tiangan and bazi.yueZhi.text == dts[0].dizhi:
  201. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  202. # if bazi.shiGan.text == dts[0].tiangan and bazi.shiZhi.text == dts[0].dizhi:
  203. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  204. def __check_yima(bazi: BaZi):
  205. key = "驿马"
  206. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  207. # dts1 = Yima.select().where(Yima.dizhi == bazi.nianZhi.text)
  208. # if len(dts1) > 0:
  209. # if bazi.yueZhi.text == dts1[0].chong:
  210. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  211. # if bazi.riZhi.text == dts1[0].chong:
  212. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  213. # if bazi.shiZhi.text == dts1[0].chong:
  214. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  215. # dts2 = Yima.select().where(Yima.dizhi == bazi.riZhi.text)
  216. # if len(dts2) > 0:
  217. # if bazi.nianZhi.text == dts2[0].chong:
  218. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  219. # if bazi.yueZhi.text == dts2[0].chong:
  220. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  221. # if bazi.shiZhi.text == dts2[0].chong:
  222. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  223. def __check_jiangxing(bazi: BaZi):
  224. key = "将星"
  225. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  226. # ary = ["子", "午", "卯", "酉"]
  227. # if ary.__contains__(bazi.nianZhi.text):
  228. # wz = SiZhuWeiZhi.nianzhu
  229. # dz = SiZhuWeiZhi.nianzhi
  230. # bazi.add_shensha(wz, key, tip, __get_jiangxing_effect(bazi, dz))
  231. # if ary.__contains__(bazi.yueZhi.text):
  232. # wz = SiZhuWeiZhi.yuezhu
  233. # dz = SiZhuWeiZhi.yuezhi
  234. # bazi.add_shensha(wz, key, tip, __get_jiangxing_effect(bazi, dz))
  235. # if ary.__contains__(bazi.riZhi.text):
  236. # wz = SiZhuWeiZhi.rizhu
  237. # dz = SiZhuWeiZhi.rizhi
  238. # bazi.add_shensha(wz, key, tip, __get_jiangxing_effect(bazi, dz))
  239. # if ary.__contains__(bazi.shiZhi.text):
  240. # wz = SiZhuWeiZhi.shizhu
  241. # dz = SiZhuWeiZhi.shizhi
  242. # bazi.add_shensha(wz, key, tip, __get_jiangxing_effect(bazi, dz))
  243. def __check_yangren(bazi: BaZi):
  244. key = "羊刃"
  245. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  246. # if bazi.nianZhi.shiShen == "劫":
  247. # # dts = Zhangsheng.select().where(Zhangsheng.tiangan == bazi.riGan.text, Zhangsheng.dizhi == bazi.nianZhi.text)
  248. # # if len(dts) > 0:
  249. # # if dts[0].zhangsheng == "帝":
  250. # # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  251. # pass
  252. #
  253. # if bazi.yueZhi.shiShen == "劫":
  254. # # dts = Zhangsheng.select().where(Zhangsheng.tiangan == bazi.riGan.text, Zhangsheng.dizhi == bazi.yueZhi.text)
  255. # # if len(dts) > 0:
  256. # # if dts[0].zhangsheng == "帝":
  257. # # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  258. # pass
  259. #
  260. # if bazi.riZhi.shiShen == "劫":
  261. # # dts = Zhangsheng.select().where(Zhangsheng.tiangan == bazi.riGan.text, Zhangsheng.dizhi == bazi.riZhi.text)
  262. # # if len(dts) > 0:
  263. # # if dts[0].zhangsheng == "帝":
  264. # # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  265. # pass
  266. #
  267. # if bazi.shiZhi.shiShen == "劫":
  268. # # dts = Zhangsheng.select().where(Zhangsheng.tiangan == bazi.riGan.text, Zhangsheng.dizhi == bazi.shiZhi.text)
  269. # # if len(dts) > 0:
  270. # # if dts[0].zhangsheng == "帝":
  271. # # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  272. # pass
  273. def __check_diwang(bazi: BaZi):
  274. key = "地网"
  275. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  276. # if bazi.nianZhi.text == "辰" or bazi.nianZhi.text == "戌":
  277. # if bazi.yueZhi.text == "巳" or bazi.yueZhi.text == "亥":
  278. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  279. # if bazi.riZhi.text == "巳" or bazi.riZhi.text == "亥":
  280. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  281. # if bazi.shiZhi.text == "巳" or bazi.shiZhi.text == "亥":
  282. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  283. # if bazi.riZhi.text == "辰" or bazi.riZhi.text == "戌":
  284. # if bazi.nianZhi.text == "巳" or bazi.nianZhi.text == "亥":
  285. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  286. # if bazi.yueZhi.text == "巳" or bazi.yueZhi.text == "亥":
  287. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  288. # if bazi.shiZhi.text == "巳" or bazi.shiZhi.text == "亥":
  289. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  290. def __check_huagai(bazi: BaZi):
  291. key = "华盖"
  292. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  293. # dt1 = Huagai.select().where(Huagai.nianzhi == bazi.nianZhi.text)
  294. # if len(dt1) > 0:
  295. # if bazi.yueZhi.text == dt1[0].dizhi:
  296. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  297. # if bazi.riZhi.text == dt1[0].dizhi:
  298. # bazi.add_shensha(SiZhuWeiZhi.rizhu, key, tip)
  299. # if bazi.shiZhi.text == dt1[0].dizhi:
  300. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  301. # dt2 = Huagai.select().where(Huagai.rizhi == bazi.riZhi.text)
  302. # if len(dt2) > 0:
  303. # if bazi.nianZhi.text == dt2[0].dizhi:
  304. # bazi.add_shensha(SiZhuWeiZhi.nianzhu, key, tip)
  305. # if bazi.yueZhi.text == dt2[0].dizhi:
  306. # bazi.add_shensha(SiZhuWeiZhi.yuezhu, key, tip)
  307. # if bazi.shiZhi.text == dt2[0].dizhi:
  308. # bazi.add_shensha(SiZhuWeiZhi.shizhu, key, tip)
  309. def __check_taohua(bazi: BaZi):
  310. key = "桃花"
  311. # tip = ShenshaTips.select().where(ShenshaTips.shensha == key)[0].tips
  312. # dts1 = Taohua.select().where(Taohua.nianzhi == bazi.nianZhi.text)
  313. # if len(dts1) > 0:
  314. # if bazi.yueZhi.text == dts1[0].dizhi:
  315. # wz = SiZhuWeiZhi.yuezhu
  316. # dz = SiZhuWeiZhi.yuezhi
  317. # zhu = bazi.yueZhi
  318. # gan = bazi.yueGan
  319. # zhuStr = "月柱"
  320. # bazi.add_shensha(wz, key, tip, __get_taohua_effect(bazi, zhu, gan, wz, dz, zhuStr))
  321. # if bazi.riZhi.text == dts1[0].dizhi:
  322. # wz = SiZhuWeiZhi.rizhu
  323. # dz = SiZhuWeiZhi.rizhi
  324. # zhu = bazi.riZhi
  325. # gan = bazi.riGan
  326. # zhuStr = "日柱"
  327. # bazi.add_shensha(wz, key, tip, __get_taohua_effect(bazi, zhu, gan, wz, dz, zhuStr))
  328. # if bazi.shiZhi.text == dts1[0].dizhi:
  329. # wz = SiZhuWeiZhi.shizhu
  330. # dz = SiZhuWeiZhi.shizhi
  331. # zhu = bazi.shiZhi
  332. # gan = bazi.shiGan
  333. # zhuStr = "时柱"
  334. # bazi.add_shensha(wz, key, tip, __get_taohua_effect(bazi, zhu, gan, wz, dz, zhuStr))
  335. #
  336. # dts2 = Taohua.select().where(Taohua.rizhi == bazi.riZhi.text)
  337. # if len(dts2) > 0:
  338. # if bazi.nianZhi.text == dts2[0].dizhi:
  339. # wz = SiZhuWeiZhi.nianzhu
  340. # dz = SiZhuWeiZhi.nianzhi
  341. # zhu = bazi.nianZhi
  342. # gan = bazi.nianGan
  343. # zhuStr = "年柱"
  344. # bazi.add_shensha(wz, key, tip, __get_taohua_effect(bazi, zhu, gan, wz, dz, zhuStr))
  345. # if bazi.yueZhi.text == dts2[0].dizhi:
  346. # wz = SiZhuWeiZhi.yuezhu
  347. # dz = SiZhuWeiZhi.yuezhi
  348. # zhu = bazi.yueZhi
  349. # gan = bazi.yueGan
  350. # zhuStr = "月柱"
  351. # bazi.add_shensha(wz, key, tip, __get_taohua_effect(bazi, zhu, gan, wz, dz, zhuStr))
  352. # if bazi.shiZhi.text == dts2[0].dizhi:
  353. # wz = SiZhuWeiZhi.shizhu
  354. # dz = SiZhuWeiZhi.shizhi
  355. # zhu = bazi.shiZhi
  356. # gan = bazi.shiGan
  357. # zhuStr = "时柱"
  358. # bazi.add_shensha(wz, key, tip, __get_taohua_effect(bazi, zhu, gan, wz, dz, zhuStr))
  359. def __get_jiangxing_effect(bazi: BaZi, wz: SiZhuWeiZhi):
  360. eft = None
  361. if bazi.hasGaoNeng("子午冲", wz):
  362. eft = "冲中神为灾(子午冲)"
  363. elif bazi.hasGaoNeng("卯酉冲", wz):
  364. eft = "冲中神为灾(卯酉冲)"
  365. return eft
  366. def __get_zaisha_effect(bazi: BaZi, wz: SiZhuWeiZhi):
  367. return __get_jiangxing_effect(bazi, wz)
  368. def __get_taohua_effect(bazi: BaZi, zhu: SiZhu, gan: SiZhu, wzOfZhu: SiZhuWeiZhi, wzOfZhi: SiZhuWeiZhi, zhuStr: str):
  369. result = None
  370. effects = []
  371. # 落生旺之地(同柱长生1-5位置)
  372. shengwang = ["生", "沐", "冠", "临", "帝"]
  373. if zhu.tongzhuZhangSheng in shengwang:
  374. eft1 = "桃花落生旺之地:男命姿容俊美,好美色;女命风情万种,异性缘佳(" + zhuStr + ")。"
  375. if not eft1 in effects:
  376. effects.append(eft1)
  377. # 见水
  378. if zhu.wuXing == "水":
  379. eft2 = "桃花见水:生理欲望强,两性关系混乱(" + zhuStr + ")。"
  380. if not eft2 in effects:
  381. effects.append(eft2)
  382. # 落时支
  383. if zhu == bazi.shiZhi:
  384. eft3 = "桃花落门户:墙外桃花,易犯桃花劫(" + zhuStr + ")。"
  385. if not eft3 in effects:
  386. effects.append(eft3)
  387. # 时支且伤官
  388. if zhu == bazi.shiZhi and zhu.shiShen == "伤":
  389. eft4 = "时支桃花落伤官:多夫,婚姻不美满(" + zhuStr + ")。"
  390. if not eft4 in effects:
  391. effects.append(eft4)
  392. # 落年月柱
  393. if zhu == bazi.nianZhi or zhu == bazi.yueZhi:
  394. eft5 = "内桃花:夫妻恩爱(" + zhuStr + ")。"
  395. if not eft5 in effects:
  396. effects.append(eft5)
  397. # 落日柱
  398. if zhu == bazi.riZhi:
  399. eft6 = "日柱桃花:夫妻纠纷多,易吵架(" + zhuStr + ")。"
  400. if not eft6 in effects:
  401. effects.append(eft6)
  402. # 和七杀同柱
  403. if zhu.shiShen == "杀" or gan.shiShen == "杀":
  404. eft7 = "和七杀同柱:情人多,欲望强。女命易产生情色交易,男命易得女贵人相助。身弱女命易被迫堕入风尘,男命易因欲望犯罪(" + zhuStr + ")。"
  405. if not eft7 in effects:
  406. effects.append(eft7)
  407. # 和禄神同柱
  408. if bazi.hasShenSha("禄神", wzOfZhu):
  409. eft8 = "和禄神同柱:异性缘好(" + zhuStr + ")。"
  410. if not eft8 in effects:
  411. effects.append(eft8)
  412. # 和羊刃同柱
  413. if bazi.hasShenSha("羊刃", wzOfZhu):
  414. eft9 = "和羊刃同柱:容易招惹风波(" + zhuStr + ")。"
  415. if not eft9 in effects:
  416. effects.append(eft9)
  417. # 和空亡同柱
  418. if bazi.hasShenSha("空亡", wzOfZhu):
  419. eft10 = "和空亡同柱:人缘欠缺,一生多苦情(" + zhuStr + ")。"
  420. if not eft10 in effects:
  421. effects.append(eft10)
  422. # 带刑,这里的zhu实际上传入的是地支
  423. if bazi.hasGaoNengKey("刑", wzOfZhi):
  424. eft11 = "桃花带刑:容易婚变(" + zhuStr + ")。"
  425. if not eft11 in effects:
  426. effects.append(eft11)
  427. # 与正印正官同柱
  428. yinguan = False
  429. if zhu.shiShen == "印" or gan.shiShen == "印":
  430. yinguan = True
  431. elif zhu.shiShen == "官" or gan.shiShen == "官":
  432. yinguan = True
  433. if yinguan is True:
  434. eft12 = "和官印同柱:有自控力,约束性强,不至于滥情(" + zhuStr + ")。"
  435. if not eft12 in effects:
  436. effects.append(eft12)
  437. # 与食神同柱
  438. if zhu.shiShen == "食" or gan.shiShen == "食":
  439. eft13 = "和食神同柱:把欲望转化为文学、艺术才华(" + zhuStr + ")。"
  440. if not eft13 in effects:
  441. effects.append(eft13)
  442. # 与伤官同柱
  443. if zhu.shiShen == "伤" or gan.shiShen == "伤":
  444. eft14 = "和伤官同柱:欲望强,喜新厌旧,容易自恃才貌,追求时髦,对感情不在乎(" + zhuStr + ")。"
  445. if not eft14 in effects:
  446. effects.append(eft14)
  447. # 与劫财同柱
  448. if zhu.shiShen == "劫" or gan.shiShen == "劫":
  449. eft15 = "和劫财同柱:容易横刀夺爱,敢爱敢恨,争风吃醋(" + zhuStr + ")。"
  450. if not eft15 in effects:
  451. effects.append(eft15)
  452. # 与偏印同柱
  453. if zhu.shiShen == "枭" or gan.shiShen == "枭":
  454. eft16 = "和偏印同柱:容易生理欲望强,同性相恋(" + zhuStr + ")。"
  455. if not eft16 in effects:
  456. effects.append(eft16)
  457. # 与比肩同柱
  458. if zhu.shiShen == "比" or gan.shiShen == "比":
  459. eft17 = "和比肩同柱:容易孤芳自赏,自己喜欢上自己,单身主义(" + zhuStr + ")。"
  460. if not eft17 in effects:
  461. effects.append(eft17)
  462. if len(effects) > 0:
  463. result = ""
  464. for s in effects:
  465. result += s + "\n"
  466. return result