Modifying Attribute Scaling
Relevant source files
The following files were used as context for generating this wiki page:
- index.html
- Quest.html
- README.md
- index.html:112-121 (Logic for Rank Configurations)
- Quest.html:124-131 (Logic for Level Calculations)
The "Modifying Attribute Scaling" system governs how player progression is calculated and rewarded based on accumulated points within the Solo Leveling Penalty System. This system defines the thresholds for player Ranks, the difficulty of assigned tasks, and the scaling of experience (XP) requirements needed to advance levels.
The primary mechanism for scaling involves a mapping of point thresholds to specific configuration objects. These configurations dictate the rewards for completing tasks, the penalties for failure, and the specific difficulty tier (e.g., 'f', 'd', 'a', 'r') applied to generated tasks.
Rank Configuration and Thresholds
The core of attribute scaling is defined in the getRankConfig function. This function acts as a lookup table that returns scaling parameters based on the user's current total points.
Scaling Parameters Table
| Rank | Point Threshold | Reward (XP) | Penalty | XP Requirement | Difficulty Tier |
|---|---|---|---|---|---|
| R | 3000+ | 6 | 8 | 50 | r |
| SS | 2000 | 6 | 8 | 40 | r |
| S | 1200 | 4 | 6 | 30 | a |
| A | 800 | 4 | 6 | 25 | a |
| B | 500 | 4 | 6 | 20 | d |
| C | 300 | 3 | 5 | 15 | d |
| D | 150 | 3 | 5 | 12 | d |
| E | 70 | 2 | 3 | 10 | f |
| F | 0 | 2 | 3 | 10 | f |
Sources: index.html:112-121, Quest.html:112-121
Rank Scaling Logic Flow
The following diagram illustrates how the system determines the scaling configuration when a user's points are updated:
Sources: index.html:113-120, Quest.html:113-120
Level Scaling Mechanics
Leveling is not a linear progression; it uses a dynamic requirement system where the "points needed for next level" (XP requirement) changes based on the current rank configuration.
Level Calculation Algorithm
The level is calculated by iteratively subtracting the required XP for the current level from the total points until the remainder is less than the next level's requirement.
- Initial State: Start at Level 1.
- Early Leveling: For levels below 6, the requirement is hardcoded to 5 points.
- Rank-Based Scaling: For levels 6 and above, the requirement is fetched from the
getRankConfig(pts).reqproperty. - Progress Percentage: Calculated as
(Remaining Points / Current Level Requirement) * 100.
Sources: index.html:124-131, Quest.html:124-131
Level Progression Sequence
Sources: index.html:124-131, Quest.html:124-131
Impact on Task Generation
The scaling system directly influences the difficulty of tasks presented to the user. The diff property (Difficulty Tier) from the rank configuration determines which string is selected from the taskDatabase.
Task Difficulty Selection Logic
When generateTasks() is called:
- It retrieves the current config via
getRankConfig(systemData.points). - It extracts the
diffkey (f, d, a, or r). - It maps this key to the corresponding task requirement. For example, a physical task for Rank F (diff 'f') might be "10 pushups," while Rank R (diff 'r') scales to "100 pushups."
const p = shuffle([...taskDatabase.physical]).slice(0, 2).map(t => ({
n: t[diff] || t['f'],
c: 'جسدي',
d: false
}));
Sources: index.html:150-155, Quest.html:150-155
Data Persistence and Scaling Updates
Attribute scaling is recalculated in real-time during UI updates and task interactions.
- Point Interaction: When a task is toggled (
toggleTask), points are added/subtracted based on theconfig.rewardvalue of the current rank. - Daily Reset: During the daily cycle check (
checkDailyCycle), if tasks were missed, the system applies a penalty based onconfig.pen. - UI Refresh: The
updateUIfunction calls bothgetRankConfigandcalculateLevelto ensure the Rank badge, Level text, and XP bar accurately reflect the scaled attributes.
Sources: index.html:134-147, index.html:160-184, Quest.html:134-147
Summary of Scaling Impact
Attribute scaling in this project creates a "treadmill" effect where higher ranks provide more rewards but impose stricter penalties and significantly higher XP requirements for level advancement, effectively managing the player's progression speed.
Sources: index.html:112-131, Quest.html:112-131