From bdbff99a9a186b75115bd996870b508fb458b808 Mon Sep 17 00:00:00 2001 From: 732642856 <732642856@qq.com> Date: Fri, 2 Oct 2026 15:49:09 +0800 Subject: [PATCH] fix: align Pancha Mahapurusha combustion profile (cherry picked from commit eaf6918ba9cedc1ab6a7cbb70336dcf010fd77dd) --- scripts/pancha_mahapurusha.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/pancha_mahapurusha.py b/scripts/pancha_mahapurusha.py index 1c6f0971..14aa8a7f 100644 --- a/scripts/pancha_mahapurusha.py +++ b/scripts/pancha_mahapurusha.py @@ -42,7 +42,14 @@ EXALTATION = {'Sun':('Aries',10),'Moon':('Taurus',3),'Mars':('Capricorn',28),'Me OWN_SIGNS = {'Sun':{'Leo'},'Moon':{'Cancer'},'Mars':{'Aries','Scorpio'},'Mercury':{'Gemini','Virgo'},'Jupiter':{'Sagittarius','Pisces'},'Venus':{'Taurus','Libra'},'Saturn':{'Capricorn','Aquarius'}} # Combustion orb (degrees from Sun) -COMBUSTION_ORB = {'Mars':17,'Mercury':12,'Jupiter':11,'Venus':10,'Saturn':15} +COMBUSTION_ORB = { + 'Moon': {'direct': 12, 'retrograde': 12}, + 'Mars': {'direct': 17, 'retrograde': 10}, + 'Mercury': {'direct': 14, 'retrograde': 12}, + 'Jupiter': {'direct': 11, 'retrograde': 10}, + 'Venus': {'direct': 10, 'retrograde': 8}, + 'Saturn': {'direct': 15, 'retrograde': 10}, +} NATURAL_MALEFICS = {"Saturn", "Mars", "Sun", "Rahu", "Ketu"} @@ -55,9 +62,10 @@ def _is_exalted_or_own(planet: str, sign: str) -> bool: return False -def _is_combust(planet: str, planet_degree: float, sun_degree: float) -> bool: +def _is_combust(planet: str, planet_degree: float, sun_degree: float, retrograde: bool = False) -> bool: """检查行星是否被太阳燃烧""" - orb = COMBUSTION_ORB.get(planet, 10) + profile = COMBUSTION_ORB.get(planet, {'direct': 10}) + orb = profile.get('retrograde' if retrograde else 'direct', profile.get('direct', 10)) diff = abs(planet_degree - sun_degree) if diff > 180: diff = 360 - diff @@ -114,8 +122,10 @@ def detect_pancha_mahapurusha(planets: Dict, sun_degree: float = None) -> List[D # 1. 燃烧检测 if sun_deg is not None: planet_deg = pd.get('degree', 0) - if _is_combust(planet, planet_deg, sun_deg): - cancellations.append(f"{planet}被太阳燃烧(orb < {COMBUSTION_ORB.get(planet,10)}°) — Yoga效力大减") + if _is_combust(planet, planet_deg, sun_deg, bool(pd.get('retrograde'))): + profile = COMBUSTION_ORB.get(planet, {'direct': 10}) + threshold = profile.get('retrograde' if pd.get('retrograde') else 'direct', profile.get('direct', 10)) + cancellations.append(f"{planet}被太阳燃烧(orb < {threshold}°) — Yoga效力大减") is_valid = False # 2. 逆行检测