Flawless Fight Cap
Limits extra turn rewards from flawless forest fights. Default cap: 5 flawless victories per day (maxflaw setting). After reaching daily limit, additional flawless fights grant no bonus turns. Cap resets at newday. Prevents infinite turn farming exploit. Message displayed when limit reached: "You have already received the maximum flawless fight rewards for today.".
What is a Flawless Fight?
Definition: Forest combat where you take ZERO damage (diddamage = 0)
Normal Flawless Reward:
- Win fight without taking any HP damage
- Receive +1 bonus forest turn
- Allows extended grinding sessions
- Skilled players can chain flawless fights indefinitely
Problem:
- High-level players with good equipment can go flawless consistently
- Infinite turn generation breaks game balance
- Players can grind 100+ fights in single day
- Unfair advantage over casual players
How the Cap Works
Daily Limit: 5 flawless fight bonuses (default maxflaw setting)
Tracking:
- Module counts flawless victories via battle-victory hook
- Increments "flaw" pref for each flawless win
- When flaw >= maxflaw: Block bonus turn reward
- Reset flaw to 0 at newday
Message When Capped:
- "You have already received the maximum flawless fight rewards for today."
- Displayed in battle victory output
- Normal combat XP/gold still awarded
- Only blocks the +1 bonus turn
Example Scenario
Day 1:
- Start with 10 forest turns
- Fight 1: Flawless → +1 turn (total: 10)
- Fight 2: Flawless → +1 turn (total: 10)
- Fight 3: Flawless → +1 turn (total: 10)
- Fight 4: Flawless → +1 turn (total: 10)
- Fight 5: Flawless → +1 turn (total: 10, flaw cap reached!)
- Fight 6: Flawless → No bonus (capped message), total: 9
- Fight 7: Flawless → No bonus, total: 8
- Etc.
You got 5 bonus turns from flawless fights, then cap kicked in.
Day 2 (after newday):
- flaw pref reset to 0
- Start fresh with new 10 turns
- Can earn 5 more flawless bonuses
Settings
- maxflaw: Max flawless fight bonuses per day (default 5)
Admins can adjust this value:
- Higher (10+): More generous, allows more grinding
- Lower (1-3): Stricter limit, less grinding advantage
- 0: Completely disable flawless bonuses (harsh!)
Impact on Gameplay
Before Flawless Cap Module:
- Skilled players fight 50-100+ times per day
- Exponential XP/gold advantage
- New players can't compete
- Imbalanced progression
After Flawless Cap Module:
- Max ~15 fights per day (10 base + 5 flawless bonuses)
- Limited grinding ceiling
- Levels playing field between casual and hardcore
- Still rewards skill (5 bonus turns = significant)
Strategy
For High-Skill Players:
- Optimize equipment for flawless fights
- Use first 5 flawless bonuses on high-XP targets
- After cap, consider switching to non-combat activities
- Accept that infinite grinding is no longer possible
For Low-Skill Players:
- Don't worry about cap - you probably won't hit it
- Focus on improving equipment/stats to achieve flawless
- Every flawless bonus is valuable - don't waste on easy fights
Maximizing Value:
- Save flawless attempts for high-level forest creatures
- More XP per fight = better use of limited bonuses
- Don't "waste" flawless on trivial opponents
Technical Details
Hooks:
- battle-victory: Check if flawless, count toward limit, block if capped
- newday: Reset flaw pref to 0
Detection:
- Checks if args['type'] == "forest" (only forest fights count)
- Checks if diddamage != 1 (flawless = took no damage)
- Uses static $runonce to prevent double-counting multi-badguy fights
Blocking Mechanism:
- Sets $options['denyflawless'] with cap message
- Core game reads this option and skips turn bonus
Balance Considerations
Why 5?
- 5 bonuses = 50% increase in daily fights (10 base → 15 total)
- Significant reward for skill without breaking economy
- Achievable for moderately skilled players
- Not so high that it creates massive imbalance
Alternative Settings:
- 3: More restrictive, favors casual play
- 10: More generous, allows more grinding
- 0: Disabled - no flawless bonuses ever (very punishing)
FAQ
Q: Do graveyard/PVP flawless fights count toward cap?
A: No. Only forest fights (args['type'] == "forest") are counted.
Q: If I take damage in round 1 but win, does it use a flawless charge?
A: No. You must take ZERO damage for entire fight. If diddamage = 1 (took any damage), no flawless bonus attempted.
Q: Can admins disable the cap?
A: Yes. Set maxflaw to 999 (effectively unlimited) or uninstall module.
Q: Does cap reset at midnight or at my personal newday?
A: Your personal newday (whenever you trigger newday hook).
Flawless Fight Cap: where the game says "congratulations on being good at combat, here are 5 bonus turns, now stop showing off and let the casuals catch up." Balance through artificial scarcity, because infinite grinding breaks capitalism (even the imaginary wizard kind).