lunisolar
Version:
专业农历库,支持公历阴历互转,支持各类黄历数据查询,如八字四柱、阴历、神煞宜忌、时辰吉凶、建除十二神、胎神占方、五行纳音等。支持自定义插件。
69 lines (67 loc) • 2.27 kB
text/typescript
import { getBranchValue } from '../../../utils'
import { getCommonCheckGodFunc } from '../utils'
import { jieShaBadAct, jieShaBadActStr, commonOnlyBad2 } from '../actData'
import { MEETING_DES } from '../constants'
import { getLife12God } from './life12Gods'
import { getDuty12GodIndexAndKey } from './duty12Gods'
export const commonGods: { [key: string]: GodDictItem } = {
劫煞: [
getCommonCheckGodFunc([5, 2, 11, 8], getBranchValue, 4),
null,
jieShaBadAct,
-12,
{
actsFilter: (lsr: lunisolar.Lunisolar, gods: Set<string>) => {
const mbValue = getBranchValue(lsr, 'month')
const duty12GodKey = getDuty12GodIndexAndKey(lsr)[1]
if (
// 寅申巳亥月值收日
([2, 8, 5, 11].includes(mbValue) &&
getLife12God(lsr, 'month')[0] === 0 &&
duty12GodKey === '收') ||
// 寅申月又值六合
([2, 8].includes(mbValue) && gods.has('六合')) ||
// 巳亥值又月害,遇天德月德
([5, 11].includes(mbValue) &&
gods.has('月害') &&
['月德', '天德'].some(i => gods.has(i))) ||
// 辰戌丑未值除日,相日, 與德并
([4, 7, 10, 1].includes(mbValue) &&
(duty12GodKey === '除' || (gods.has('相日') && MEETING_DES.some(i => gods.has(i)))))
) {
return {
replace: {
bad: commonOnlyBad2
}
}
}
return null
}
}
],
災煞: [
getCommonCheckGodFunc([6, 3, 0, 9], getBranchValue, 4),
null,
`${jieShaBadActStr} 苫蓋`.split(' '),
-12,
{
actsFilter: (lsr: lunisolar.Lunisolar, gods: Set<string>) => {
const mbValue = getBranchValue(lsr, 'month')
const duty12GodKey = getDuty12GodIndexAndKey(lsr)[1]
if (
// 寅申巳亥月值開日 辰戌丑未值滿日, 遇德
(([2, 8, 5, 11].includes(mbValue) && duty12GodKey === '開') ||
([4, 7, 10, 1].includes(mbValue) && duty12GodKey === '滿')) &&
MEETING_DES.some(i => gods.has(i))
) {
return {
replace: {
bad: commonOnlyBad2
}
}
}
return null
}
}
]
}