Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ MOKSHA/
| **प्रारब्ध** | `prarabdha` | प्रति पुनर्जन्म केवल +1 (संचित कर्म कितना भी हो); MAX_PRARABDHA=15 cap; भोग से घटता है (×1.15 samaya penalty); 10 नाम से 2× गति |
| **समर्पित** | `samarpita` | जब >= CHETANA_JAGRITI_THRESHOLD (50), चेतना-जागृति ट्रिगर |
| **चेतना-जागृति** | `chetanaaJaagrita` (boolean) | **मोक्ष की प्रामाणिक शर्त** — `samarpita >= 50` ट्रिगर; जागृति पर `isKarmaImmune = true` (गीता 4.37) |
| **नाम** | `activeNaam` | 1 नाम=पुण्य भस्म, 5=पाप भस्म|
| **नाम** | `sanchitaNaama` | 1 नाम=पुण्य भस्म, 5=पाप भस्म|
| **कृपा** | `kripa` | बंधन हो → kripa-- व कर्म समर्पित में; बंधन न हो → kripa++ |
| **शंख** | `shankha` | Y/gamepad — chakravaata-शमन हेतु |
| **ज्योति** | `jyoti` | B/gamepad — पाप-अंधकार में दृष्टि हेतु |
Expand All @@ -214,7 +214,7 @@ if (shuvhaKarma === 0 && ashuvhaKarma === 0 && !pendingGoodKarma
### 1.3 पुनर्जन्म — पवित्र बनाम अपवित्र
```js
let isApavitra = (shuvhaKarma > 0 || ashuvhaKarma > 0 || prarabdha > 0);
let earnsKripaOnRebirth = (activeNaam >= 20 || samarpita >= 30 || chetanaaJaagrita);
let earnsKripaOnRebirth = (sanchitaNaama >= 20 || samarpita >= 30 || chetanaaJaagrita);
```
सिर्फ कर्म-बंधन शेष रहने पर "अपवित्र" — समर्पित/नाम की कमी "अपवित्र" नहीं।

Expand Down Expand Up @@ -245,7 +245,7 @@ grantKripa(x, y, reason = null) {
### 2.1 कर्म/मोक्ष-संबंधी स्टेट
`KarmaEngine` class की properties (सभी `engine.*` से access करें):
```
engine.shuvhaKarma, engine.ashuvhaKarma, engine.activeNaam — वर्तमान सक्रिय मात्रा
engine.shuvhaKarma, engine.ashuvhaKarma, engine.sanchitaNaama — वर्तमान सक्रिय मात्रा
engine.prarabdha, engine.samarpita, engine.punaraJanmaCount — संचित/आजीवन काउंटर
engine.kripa, engine.shankha, engine.jyoti — दुर्लभ resource काउंटर
engine.chetanaaJaagrita (boolean) — मोक्ष-गेट
Expand Down Expand Up @@ -329,7 +329,7 @@ engine.outerOrbits = [
{ count:shuvhaKarma, emoji:"🌿", color:"#32ff32", speed:0.8 }, // 0 पुण्य
{ count:ashuvhaKarma, emoji:"🥀", color:"#ff3232", speed:-0.9 }, // 1 पाप
{ count:prarabdha, emoji:"📜", color:"#a78bfa", speed:0.6 }, // 2 प्रारब्ध
{ count:activeNaam, emoji:"ॐ", color:"#ffffff", speed:1.0, glowTimer:0 }, // 3 नाम
{ count:sanchitaNaama, emoji:"ॐ", color:"#ffffff", speed:1.0, glowTimer:0 }, // 3 नाम
{ count:kripa, emoji:"✋", color:"#ffe9a8", speed:0.7 }, // 4 कृपा
{ count:shankha, emoji:"🐚", color:"#7dd3fc", speed:0.5 }, // 5 शंख
{ count:jyoti, emoji:"🪔", color:"#ffe932", speed:-0.6 }, // 6 ज्योति
Expand Down Expand Up @@ -533,7 +533,7 @@ const tutorial = new TutorialManager(
tutorial.start(engine.player.x);

// gameLoop में (हर frame — update block के अंदर):
tutorial.checkCompletion({ player, activeNaam, isNaamaJaapa,
tutorial.checkCompletion({ player, sanchitaNaama, isNaamaJaapa,
playerInTunnel, praarabdha, antimaCharanaStarted });
touch.syncWithTutorial(tutorial.hasActiveCard());

Expand Down Expand Up @@ -601,7 +601,7 @@ AM.updateAmbientVolumes();
| Step | id | शास्त्रीय श्लोक | Completion Trigger |
|---|---|---|---|
| 0 | `move` | उद्धरेदात्मनात्मानं नात्मानमवसादयेत्। | ≥40px horizontal movement |
| 1 | `maya` | मायाजालमिदं विश्वं मोहयत्यखिलं जगत्। | `activeNaam >= 1` (naama collect) |
| 1 | `maya` | मायाजालमिदं विश्वं मोहयत्यखिलं जगत्। | `sanchitaNaama >= 1` (naama collect) |
| 2 | `jaapa` | नाम जपत मंगल दिसि दसहूँ। | `isNaamaJaapa === true` (latch) |
| 3 | `tunnel` | भक्त्या मामभिजानाति यावान्यश्चास्मि तत्त्वतः। | `playerInTunnel === true` (antimaCharana के बाद) |
| 4 | `praarabdha` | भोगेन क्षीयते पापं, तपसा क्षीयते मलः। | dismiss = complete (प्रारब्ध मिलने के बाद card दिखे) |
Expand Down
24 changes: 12 additions & 12 deletions src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class KarmaEngine {
// ── Vedic Karma State ────────────────────────────────
this.shuvhaKarma = 0; // पुण्य (सक्रिय)
this.ashuvhaKarma = 0; // पाप (सक्रिय)
this.activeNaam = 0; // ॐ नाम (उपयोग-योग्य)
this.sanchitaNaama = 0; // ॐ नाम (उपयोग-योग्य)
this.praarabdha = 0; // प्रारब्ध (संचित — सिर्फ़ 10-नाम से भस्म)
this.praarabdhaTimer = 0; // भोग-countdown (frames); पुनर्जन्म पर persist, R-reset पर शून्य
this._currentGateeModifier = 1.0; // इस जन्म का live ashuvha×shuvha modifier (rebirth पर snapshot) persist, R-reset पर शून्य
Expand All @@ -141,7 +141,7 @@ export class KarmaEngine {
this.jaapaNaama = "राधा"; // नाम-जाप पर floating text
this.isNaamaJaapa = false; // क्या अभी नाम-जाप-वलय सक्रिय है?
this.naamaGhera = 0; // नाम-जाप-वलय की वर्तमान त्रिज्या
this.naamaJaapaPower = 0; // SPACE दबाने पर उपलब्ध activeNaam
this.naamaJaapaPower = 0; // SPACE दबाने पर उपलब्ध sanchitaNaama

// ── Time / Swaansa ────────────────────────────────────
this.samaya = SAMAYA_PRAARAMBHIKA;
Expand Down Expand Up @@ -413,9 +413,9 @@ export class KarmaEngine {
this._prevPraarabdhaForSound = this.praarabdha;

// ── 5. कृपा-माइलस्टोन edge-detection ────────────────
if (this.activeNaam > this._prevActiveNaamForKripa)
this._naamaSinceLastKripa += (this.activeNaam - this._prevActiveNaamForKripa);
this._prevActiveNaamForKripa = this.activeNaam;
if (this.sanchitaNaama > this._prevActiveNaamForKripa)
this._naamaSinceLastKripa += (this.sanchitaNaama - this._prevActiveNaamForKripa);
this._prevActiveNaamForKripa = this.sanchitaNaama;

while (this._naamaSinceLastKripa >= KRIPA_NAAM_MILESTONE) {
this._naamaSinceLastKripa -= KRIPA_NAAM_MILESTONE;
Expand Down Expand Up @@ -472,9 +472,9 @@ export class KarmaEngine {
if (this.samaya < 100 && this.samaya > 0 && !this.swaansaSamapta
&& !this._prevSamaya100Guided) {
this._prevSamaya100Guided = true;
if (this.activeNaam > 0 && this.playerInTunnel) {
if (this.sanchitaNaama > 0 && this.playerInTunnel) {
this._alertKey('samaya100Tunnel', '🌿', 'achievement');
} else if (this.activeNaam > 0) {
} else if (this.sanchitaNaama > 0) {
this._alertKey('samaya100Path', '🌿', 'guidance');;
} else {
this._alertKey('samaya100NoNaam', '⚠️', 'warning');
Expand Down Expand Up @@ -647,7 +647,7 @@ export class KarmaEngine {
if (m.isPulling) this._mayaConsumedWhilePulling = true;

if (m.type === 'naama') {
this.activeNaam++;
this.sanchitaNaama++;
this._addFloatingText("ॐ", "#ffffff", { x:mCx, y:mCy });
this._createGainedGlow(mCx, mCy, "#ffffff");
this.naamaGlowTimer = 40; this._triggerGlow("#ffffff");
Expand Down Expand Up @@ -676,7 +676,7 @@ export class KarmaEngine {

// वलय पूर्ण — नाम-शक्ति जाँचें
// ⚠️ शास्त्र-संगत (Issue #11): प्रारब्ध नाम-जाप से नष्ट नहीं होता।
// activeNaam >= 10 होने पर praarabdhaTimer 2× गति से घटता है (§22.5)।
// sanchitaNaama >= 10 होने पर praarabdhaTimer 2× गति से घटता है (§22.5)।
if (this.naamaGhera > NAAMA_JAAP_MAX_RADIUS) {
this.isNaamaJaapa = false; this.naamaGhera = 0;
this._alertKey('naamaJapa', '🌿', 'achievement');
Expand Down Expand Up @@ -883,7 +883,7 @@ export class KarmaEngine {

// ── praarabdha unit घटाने का logic ──
const prevPraarabdha = this.praarabdha;
const bhogDt = dt * (this.activeNaam >= 10 ? 2 : 1);
const bhogDt = dt * (this.sanchitaNaama >= 10 ? 2 : 1);
this.praarabdhaTimer = Math.max(0, this.praarabdhaTimer - bhogDt);
const newPraarabdha = this.praarabdhaTimer > 0
? Math.ceil(this.praarabdhaTimer / PRARABDHA_BHOG_FRAMES) : 0;
Expand Down Expand Up @@ -1072,7 +1072,7 @@ export class KarmaEngine {
reset() {
// ── Karma reset ──
this.praarabdha = 0; this.praarabdhaTimer = 0; this.shuvhaKarma = 0; this.ashuvhaKarma = 0;
this.praarabdhaPenaltiMul = 1.0; this._praarabdhaSpeedMul = 1.0; this._praarabdhaSpeedStack = []; this.activeNaam = 0; this.samarpita = 0; this.punaraJanmaCount = 0; this.isKarmaImmune = false; this.kripa = 0; this.shankha = 0; this.jyoti = 0;
this.praarabdhaPenaltiMul = 1.0; this._praarabdhaSpeedMul = 1.0; this._praarabdhaSpeedStack = []; this.sanchitaNaama = 0; this.samarpita = 0; this.punaraJanmaCount = 0; this.isKarmaImmune = false; this.kripa = 0; this.shankha = 0; this.jyoti = 0;
// ── Alert queue reset ──
this.alertQueue = []; this._nextAlertId = 0;
if(this.outerOrbits[2]) this.outerOrbits[2].glowTimer = 0;
Expand Down Expand Up @@ -1157,7 +1157,7 @@ export class KarmaEngine {
// Karma
shuvhaKarma: this.shuvhaKarma,
ashuvhaKarma: this.ashuvhaKarma,
activeNaam: this.activeNaam,
sanchitaNaama: this.sanchitaNaama,
praarabdha: this.praarabdha,
praarabdhaTimer: this.praarabdhaTimer,
samarpita: this.samarpita,
Expand Down
38 changes: 19 additions & 19 deletions src/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const KarmaMixin = {
this.outerOrbits[0].count = this.shuvhaKarma;
this.outerOrbits[1].count = this.ashuvhaKarma;
this.outerOrbits[2].count = this.praarabdha;
this.outerOrbits[3].count = this.activeNaam;
this.outerOrbits[3].count = this.sanchitaNaama;
this.outerOrbits[4].count = this.kripa;
this.outerOrbits[5].count = this.shankha;
this.outerOrbits[6].count = this.jyoti;
Expand Down Expand Up @@ -79,7 +79,7 @@ export const KarmaMixin = {
// ── पुनर्जन्म (अपवित्र/पवित्र) ──
const isApavitra = (this.shuvhaKarma > 0 || this.ashuvhaKarma > 0);
const earnsKripaOnRebirth = (
this.activeNaam >= 20 || this.samarpita >= 30 || this.chetanaaJaagrita
this.sanchitaNaama >= 20 || this.samarpita >= 30 || this.chetanaaJaagrita
);
// ── Bug 5 fix: pendingGoodKarma clear करने से पहले capture करें ──
// पहले false किया → hasSanchitaKarma में already false → praarabdha +1 miss
Expand Down Expand Up @@ -162,7 +162,7 @@ export const KarmaMixin = {
"#ffe9a8"
);
this._addFloatingText("✋", "#ffe9a8", { alpha:1.3, vy:-1.6, isBigName:true });
if (this.activeNaam >= 20) this._addFloatingText("ॐ", "#ffffff", { alpha:1.5, vy:-2.2, isBigName:true });
if (this.sanchitaNaama >= 20) this._addFloatingText("ॐ", "#ffffff", { alpha:1.5, vy:-2.2, isBigName:true });
if (this.samarpita >= 30) this._addFloatingText("🙏", "#fb923c", { alpha:1.5, vy:-2.2, isBigName:true });
this._alertKey('kripaAtirikta', '✋', 'guidance');
this._triggerGlow("#ffe9a8");
Expand Down Expand Up @@ -270,7 +270,7 @@ export const KarmaMixin = {
*/
_handlePlayerMayaCollision(m, cx) {
if (m.type === "naama") {
this.activeNaam++;
this.sanchitaNaama++;
this._addFloatingText("ॐ", "#ffffff");
this.naamaGlowTimer = 40;
this._triggerGlow("#ffffff");
Expand All @@ -279,8 +279,8 @@ export const KarmaMixin = {

if (this.playerInTunnel) {
// शास्त्र-संगत क्रम: पुण्य → पाप → प्रारब्ध
if (this.shuvhaKarma > 0 && this.activeNaam >= 1) {
this.activeNaam--; this.shuvhaKarma--; this.samarpita++;
if (this.shuvhaKarma > 0 && this.sanchitaNaama >= 1) {
this.sanchitaNaama--; this.shuvhaKarma--; this.samarpita++;
this._addFloatingText("🌿🌸", "#32ff32");
this._triggerGlow("#32ff32");
this._cb.playSound?.('samarpita');
Expand All @@ -289,8 +289,8 @@ export const KarmaMixin = {
? this._alertKey('bandhanaPunyaMukta', '🌿', 'achievement')
: this._alertKey('bandhanaPunyaShesha', '🌿', 'guidance',
{ n: this.shuvhaKarma });
} else if (this.ashuvhaKarma > 0 && this.activeNaam >= 5) {
this.activeNaam -= 5; this.ashuvhaKarma--; this.samarpita++;
} else if (this.ashuvhaKarma > 0 && this.sanchitaNaama >= 5) {
this.sanchitaNaama -= 5; this.ashuvhaKarma--; this.samarpita++;
this._addFloatingText("🥀🔥", "#ff3232");
this._triggerGlow("#ff3232");
this._cb.playSound?.('samarpita');
Expand Down Expand Up @@ -319,8 +319,8 @@ export const KarmaMixin = {
this._alertKey('vikshepa', '🌪️', 'warning');
return; // m.active = false नहीं — chakravaata यथावत
} else if (m.type === "shuvha") {
if (this.activeNaam >= 1) {
this.activeNaam--; this.samarpita++;
if (this.sanchitaNaama >= 1) {
this.sanchitaNaama--; this.samarpita++;
this._createExplosion(m.x + m.width / 2, m.y + m.height / 2, "#ffffff");
this._addFloatingText("🙏", "#fb923c", { x: m.x + m.width / 2, y: m.y });
this._cb.playSound?.('samarpita');
Expand All @@ -332,8 +332,8 @@ export const KarmaMixin = {
this._pendingGoodKarmaCount++;
this._cb.playSound?.('shuvha');
} else if (m.type === "ashuvha") {
if (this.activeNaam >= 5) {
this.activeNaam -= 5; this.samarpita++;
if (this.sanchitaNaama >= 5) {
this.sanchitaNaama -= 5; this.samarpita++;
this._createExplosion(m.x + m.width / 2, m.y + m.height / 2, "#ffffff");
this._addFloatingText("🙏", "#fb923c", { x: m.x + m.width / 2, y: m.y });
this._cb.playSound?.('samarpita');
Expand Down Expand Up @@ -428,9 +428,9 @@ export const KarmaMixin = {
*/
actionNaamaJaapa() {
if (this.gameOver || this.isPaused) return;
if (this.activeNaam >= 1 && !this.isNaamaJaapa) {
this.naamaJaapaPower = this.activeNaam;
this.activeNaam--;
if (this.sanchitaNaama >= 1 && !this.isNaamaJaapa) {
this.naamaJaapaPower = this.sanchitaNaama;
this.sanchitaNaama--;
this.isNaamaJaapa = true;
this.naamaGhera = this.smoothSize / 2;
this._cb.playSound?.('jaapa');
Expand All @@ -444,7 +444,7 @@ export const KarmaMixin = {
isBigName: true,
});
}
} else if (this.activeNaam === 0 && !this.isNaamaJaapa) {
} else if (this.sanchitaNaama === 0 && !this.isNaamaJaapa) {
this._alertKey('errNaamaAbsent', '❌', 'warning');
this._cb.playSound?.('ashuvha');
}
Expand Down Expand Up @@ -493,17 +493,17 @@ export const KarmaMixin = {
this._alertKey('errSamarpanaPhase', '❌', 'warning');
this._cb.playSound?.('ashuvha'); return;
}
if (this.activeNaam === 0) {
if (this.sanchitaNaama === 0) {
this._alertKey('errSamarpanaNoNaam', '❌', 'warning');
this._cb.playSound?.('ashuvha'); return;
}
if (!this.playerInTunnel) {
this._alertKey('errSamarpanaTunnel', '❌', 'warning');
this._cb.playSound?.('ashuvha'); return;
}
let gained = (this.activeNaam * 3) + (this.shankha + this.jyoti);
let gained = (this.sanchitaNaama * 3) + (this.shankha + this.jyoti);
this.samarpita += gained;
this.activeNaam = 0;
this.sanchitaNaama = 0;
this.shankha = 0;
this.jyoti = 0;
this.poornaSamarpana = true;
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ function gameLoop(ts) {
// tutorial completion हर frame check करें
tutorial.checkCompletion({
player: engine.player,
activeNaam: engine.activeNaam,
sanchitaNaama: engine.sanchitaNaama,
isNaamaJaapa: engine.isNaamaJaapa,
playerInTunnel: engine.playerInTunnel,
praarabdha: engine.praarabdha,
Expand Down
4 changes: 2 additions & 2 deletions src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ export const Renderer = {
WIDTH, HEIGHT, TUNNEL_X, TUNNEL_WIDTH, SAMAYA_PRAARAMBHIKA,
frameNow, shakeTimer, samaya, swaansaSamapta, stars, tunnelSparkles,
particlePool, glowEffectPool, player, smoothSize, glowRings,
shuvhaKarma, ashuvhaKarma, praarabdha, activeNaam, kripa, shankha, jyoti,
shuvhaKarma, ashuvhaKarma, praarabdha, sanchitaNaama, kripa, shankha, jyoti,
samarpita, punaraJanmaCount, chetanaaJaagrita, poornaSamarpana, chainSlots,
finalHorsePositions, pulledHorseIndex, pulledHorseX, pulledHorseY,
isPaused, gameOver, mayaPool, pendingGoodKarma, punyaTimer,
Expand Down Expand Up @@ -1116,7 +1116,7 @@ export const Renderer = {
if (shuvhaKarma > 0) innerOrbit.push("🌿");
if (ashuvhaKarma > 0) innerOrbit.push("🥀");
if (praarabdha > 0) innerOrbit.push("📜");
if (activeNaam > 0) innerOrbit.push("ॐ");
if (sanchitaNaama > 0) innerOrbit.push("ॐ");
if (kripa > 0) innerOrbit.push("✋");
if (shankha > 0) innerOrbit.push("🐚");
if (jyoti > 0) innerOrbit.push("🪔");
Expand Down
Loading
Loading