-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
申请更多神煞 #22
Comments
补充一下神煞的信息
|
您好,十分感谢你的支持。 const xx6Gods = [
{
name: '貴人',
/**
* 用于匹配神煞的函数
* @param lsr lunisolar实例
* @param matchBranch 要匹配的地支索引值(从0数起)
*/
test: (lsr: lunisolar.Lunisolar, matchBranch: number): boolean => {
const s = lsr.char8.day.stem.value // 取日天干
// rule[天干][地支, 地支]
const rule = [
[1, 7],
[0, 8],
[11, 9],
[11, 9],
[1, 7],
[0, 8],
[1, 7],
[2, 6],
[3, 5]
]
return rule[s].includes(matchBranch)
}
},
{
name: '祿神',
test: (lsr: lunisolar.Lunisolar, matchBranch: number): boolean => {
return [2, 3, 5, 6, 5, 6, 8, 9, 11, 0][lsr.char8.day.stem.value] === matchBranch
}
},
{
name: '羊刃',
test: (lsr: lunisolar.Lunisolar, matchBranch: number): boolean => {
return [3, 4, 6, 7, 6, 7, 9, 10, 0, 1][lsr.char8.day.stem.value] === matchBranch
}
},
{
name: '天耳',
test: (lsr: lunisolar.Lunisolar, matchBranch: number): boolean => {
const sn = lsr.getSeasonIndex() // 取得季节索引
return [5, 2, 11, 8][sn] === matchBranch
}
},
{
name: '天目',
test: (lsr: lunisolar.Lunisolar, matchBranch: number): boolean => {
const sn = lsr.getSeasonIndex() // 取得季节索引
return [11, 8, 5, 2][sn] === matchBranch
}
}
// 其它神煞类似编写...
] |
我现在自己写了一个比较简陋的,大概类似于: switch (lsr.char8.day.branch.name) {
case '申':
case '子':
case '辰':
return '寅'
} 因为神煞基本上是固定的,比如说驿马星就是根据日支来推断,然后这些神煞,有些是根据日干,有些是日支,还有一些是根据月份 |
作者您好,感谢开发出了如此优秀的框架!我在尝试自己开发一个六爻排盘软件,目前使用该框架实现四值显示,查询旬空等功能;
现在想请问下,可否加入更多六爻经常使用的神煞?比如驿马,贵人,谋星,桃花,文昌等?
The text was updated successfully, but these errors were encountered: