1
0
mirror of synced 2026-10-24 07:26:12 +08:00

v1.2.17 修复九星错误;修复太岁方位错误。

This commit is contained in:
6tail
2022-01-07 20:29:04 +08:00
parent e010e64f1a
commit 3e256ddbd3
7 changed files with 300 additions and 51 deletions

View File

@@ -132,6 +132,22 @@ public class LunarMonth {
return LunarUtil.POSITION_DESC.get(getPositionTaiSui());
}
/**
* 获取月九星
*
* @return 九星
*/
public NineStar getNineStar() {
int index = LunarYear.fromYear(year).getZhiIndex() % 3;
int m = Math.abs(month);
int monthZhiIndex = (13 + m) % 12;
int n = 27 - (index * 3);
if (monthZhiIndex < LunarUtil.BASE_MONTH_ZHI_INDEX) {
n -= 3;
}
int offset = (n - monthZhiIndex) % 9;
return NineStar.fromIndex(offset);
}
@Override
public String toString() {