fix: align Pancha Mahapurusha combustion profile

(cherry picked from commit eaf6918ba9cedc1ab6a7cbb70336dcf010fd77dd)
This commit is contained in:
732642856
2026-10-02 23:38:54 +08:00
committed by Jesse_Chen
parent cb9d942b9e
commit bdbff99a9a
+15 -5
View File
@@ -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. 逆行检测