ShenShaLogic.py 21 KB

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