三方四正与夹宫

SurroundedPalaces 与 FlankingPalaces 的字段、星耀与四化判断、文本。

SurroundedPalaces

字段说明
target本宫
opposite对宫(+6)
wealth财帛位(+8)
career官禄位(+4)

三种取法结果相同:chart.surroundedPalaces(target)、palace.surroundedPalaces()、star.surroundedPalaces()。

have(stars: readonly string[]): boolean;
notHave(stars: readonly string[]): boolean;
haveOneOf(stars: readonly string[]): boolean;
haveMutagen(mutagen: Mutagen): boolean;
notHaveMutagen(mutagen: Mutagen): boolean;
toText(options?: TextOptions): string;

判断对四宫的星耀取并集。

const sp = chart.palace(PalaceName.CAREER)!.surroundedPalaces()!;
console.log(sp.have([MajorStar.TIANFU, MajorStar.TIANXIANG]), sp.haveOneOf(['擎羊', '陀罗']),
  sp.notHave([MinorStar.DIKONG]), sp.haveMutagen(Mutagen.QUAN));
console.log(sp.toText({ detail: TextDetail.OVERVIEW }).split('\n').filter((l) => l.startsWith('#')).join('\n'));
true false true true
## 官禄 三方四正
### 本宫 · 官禄 (丙戌) · 大限 83-92 [身宫]
### 对宫 · 夫妻 (庚辰) · 大限 23-32 [来因宫]
### 财帛位 · 命宫 (壬午) · 大限 3-12
### 官禄位 · 财帛 (戊寅) · 大限 43-52

FlankingPalaces

字段 / 方法说明
previous / next前一宫(索引 −1)/ 后一宫(+1),十二宫首尾相连
astrolabe()两宫所属星盘
have / notHave / haveOneOf / haveMutagen / notHaveMutagen对两宫取并集,同上
toText(options?)两宫各一节的文本

由 chart.flankingPalaces(target) 取得,例子见星盘对象。

本页目录