Skip to content
このページの内容

星曜 ​

はじめに ​

星曜は紫微斗数の重要な構成要素であり、組み合わせによって異なる性格を表します。背景を学びたい方は星曜の体系をご覧ください。この章は開発での扱い方を説明します。

ヒント

iztroでは、主星、補助星、雑曜を星曜の体系にまとめ、48 神煞は別に扱います。48 神煞については48神煞をご覧ください。

クラスと分析メソッド ​

FunctionalAstrolabeやFunctionalPalaceと同様に、FunctionalStarを自分で生成するより、他のオブジェクトが返すインスタンスを使ってください。

FunctionalStar ^1.2.0 ​


implements IFunctionalStar extends Star
  • インターフェースの定義

    ts
    interface IFunctionalStar extends Star {
      toJSON: () => Star;
      palace: () => IFunctionalPalace | undefined;
      setPalace: (p: IFunctionalPalace) => void;
      setAstrolabe: (a: IFunctionalAstrolabe) => void;
      surroundedPalaces: () => IFunctionalSurpalaces | undefined;
      oppositePalace: () => IFunctionalPalace | undefined;
      withBrightness: (brightness: Brightness | Brightness[]) => boolean;
      withMutagen: (mutagen: Mutagen | Mutagen[]) => boolean;
    }
  • プロパティ

    参照 Star

  • メソッド

    toJSON() ^2.6.0 ​

    • 目的

      機能付き星曜を通常のJSONオブジェクトに変換します。分析メソッド、関連する宮や命盤などの実行時参照は含めず、循環参照も安全に除外します。

    • 定義

      ts
      type toJSON = () => Star;
    • パラメータ

      なし

    • 戻り値

      Star

    • 使用例

      ts
      const data = astrolabe.star("紫微").toJSON();

    ❗️注意

    FunctionalStarには、星を所属する宮と命盤に結び付けるsetPalace()とsetAstrolabe()があります。通常の利用では、データの誤りを避けるために直接呼び出さないでください。

    palace() ​

    • 目的

      星曜がある宮を取得します。

    • 定義

      ts
      type palace = () => IFunctionalPalace | undefined;
    • パラメータ

      none

    • 戻り値

      FunctionalPalace | undefined

    • 使用例

      紫微がある宮を取得します。

      ts
      import { astro } from "iztro";
      
      const astrolabe = astro.astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN");
      
      const palace = astrolabe.star("紫微").palace();

    surroundedPalaces() ​

    • 目的

      現在の星曜の三方四正に当たる宮を取得します。

    • 定義

      ts
      type surroundedPalaces = () => IFunctionalSurpalaces | undefined;
    • パラメータ

      none

    • 戻り値

      FunctionalSurpalaces | undefined

    • 使用例

      紫微がある宮の三方四正に当たる宮を取得します。

      ts
      import { astro } from "iztro";
      
      const astrolabe = astro.astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN");
      
      const palaces = astrolabe.star("紫微").surroundedPalaces();

    oppositePalace() ​

    • 目的

      現在の星曜がある宮の対宮を取得します。

    • 定義

      ts
      type oppositePalace = () => IFunctionalPalace | undefined;
    • パラメータ

      none

    • 戻り値

      FunctionalPalace | undefined

    • 使用例

      紫微がある宮の対宮を取得します。

      ts
      import { astro } from "iztro";
      
      const astrolabe = astro.astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN");
      
      const palace = astrolabe.star("紫微").oppositePalace();

    withBrightness() ​

    • 目的

      星曜が指定した輝度かどうかを判定します。複数の輝度を渡した場合は、そのうち一つでも一致すれば true を返します。

    • 定義

      ts
      type withBrightness = (brightness: Brightness | Brightness[]) => boolean;
    • パラメータ

    パラメータ型必須デフォルト値説明
    brightnessBrightness | Brightness[]true-判定する星曜の輝度
    • 戻り値

      boolean

    • 使用例

      紫微 が 廟 または 旺 の状態であるかどうかを確認します。

      ts
      import { astro } from "iztro";
      
      const astrolabe = astro.astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN");
      
      const result = astrolabe.star("紫微").withBrightness(["庙", "旺"]);

    withMutagen() ​

    • 目的

      星曜に指定した四化があるかを判定します。複数を渡した場合は、そのうち一つでも一致すれば true を返します。

    • 定義

      ts
      type withMutagen = (mutagen: Mutagen | Mutagen[]) => boolean;
    • パラメータ

    パラメータ型必須デフォルト値説明
    mutagenMutagen | Mutagen[]true-四化(祿・權・科・忌)
    • 戻り値

      boolean

    • 使用例

      紫微 が 權 または 科 の状態であるかどうかを確認します。

      ts
      import { astro } from "iztro";
      
      const astrolabe = astro.astrolabeBySolarDate("2000-8-16", 2, "女", true, "zh-CN");
      
      const result = astrolabe.star("紫微").withMutagen(["权", "科"]);

© 2025 iztro.com All rights reserved.
関連サイト: 紫微派