PerfectExtractionBonus
PerfectExtractionBonus is a host-only mod for R.E.P.O.
If every valuable that existed at the start of the level is successfully extracted before the level is cleared, the run receives a money bonus based on the current currency amount.
In addition to that regular perfect extraction bonus, this mod can also grant an extra bonus when every tracked starting valuable is extracted without any value loss at any point during the level.
The regular perfect extraction bonus does not require valuables to remain undamaged.
A valuable still counts for the regular bonus even if its value dropped due to damage, as long as that same original object is eventually extracted.
Only valuables that existed at the beginning of the level are tracked.
Valuables created later during the level are ignored for both bonus conditions.
Features
- Host-only behavior
- Grants a regular bonus based on current run currency after a perfect extraction clear
- Grants an additional no-loss bonus when all tracked starting valuables are extracted without any value loss
- Supports streak bonus scaling for consecutive perfect extractions
- Tracks only the valuables that existed at level start
- Regular perfect extraction accepts damaged valuables as valid as long as they are extracted
- No-loss bonus is disabled if any tracked starting valuable drops below its original value during the level
- Ignores valuables that appear after the initial snapshot
- Prevents duplicate level-result processing
- Optional bonus UI
- Detailed bonus logging enabled by default
How it works
The mod waits until level generation is complete, then takes a snapshot of all valuables that currently exist in the level.
Each of those valuables is tracked by object identity.
When a valuable is successfully destroyed by extraction processing, that original object is marked as delivered.
At the same time, the mod also records each tracked valuable's original value.
During the level, if any tracked starting valuable ever drops below that original value, the extra no-loss bonus condition is permanently disabled for that level.
At level completion, the mod checks whether every valuable from the initial snapshot was delivered.
If yes:
- regular perfect extraction bonus is granted
- streak increases by 1
- extra no-loss bonus is also granted if no tracked starting valuable ever lost value
If no:
- no bonus is granted
- streak can be reset depending on config
Important behavior
This mod checks the valuables that existed at the start of the level, not every valuable that may ever exist later.
For the regular perfect extraction bonus, a valuable is still considered valid even if:
- it was damaged
- its price was reduced
- it was partially broken in value terms
It only needs to be successfully extracted as the same tracked object.
For the extra no-loss bonus, every tracked starting valuable must stay at or above its original value for the entire level.
If even one tracked starting valuable drops below its original value once, the extra no-loss bonus is lost for that level.
A valuable does not count if:
- it was part of the initial set but never extracted
- it disappeared by some other method without going through extraction tracking
- it was replaced by some other object later
Host only
Only the host needs to install this mod.
The host performs all tracking, eligibility checks, streak handling, and currency bonus logic.
Clients do not need the mod for the effect to work.
Bonus calculation
Base regular formula:
regular bonus = current currency × regular bonus percent
Extra no-loss formula:
no-loss extra bonus = current currency × no-loss extra bonus percent
Total granted bonus:
total bonus = regular bonus + no-loss extra bonus
The default regular behavior is:
- first perfect extraction clear: 10%
- second consecutive perfect extraction clear: 15%
- third consecutive perfect extraction clear: 20%
This happens because streak bonus is enabled by default.
With the default extra no-loss bonus setting:
Example with defaults:
- current currency: 10000
- regular perfect extraction streak bonus result: 15%
- no-loss extra bonus: 10%
- total bonus: 1500 + 1000 = 2500
Logging
Detailed bonus logs are enabled by default.
When logging is enabled, the mod outputs:
- whether the bonus was granted
- whether the no-loss extra bonus was granted
- current streak count
- regular bonus rate calculation
- no-loss extra bonus rate calculation
- bonus amount calculation formulas
- total bonus amount calculation
- current currency before and after bonus
- no-loss disqualification reason when applicable
Configuration
ModEnabled
- Description: Enables or disables the mod
- Default: true
- Minimum: false
- Maximum: true
BaseBonusPercent
- Description: Base bonus percent for a perfect extraction clear
- Default: 10
- Minimum: 0
- Maximum: 100
EnableStreakBonus
- Description: Enables extra bonus percent for consecutive perfect extractions
- Default: true
- Minimum: false
- Maximum: true
StreakAddPercent
- Description: Additional percent added for each consecutive perfect clear after the first
- Default: 5
- Minimum: 0
- Maximum: 100
MaxBonusPercent
- Description: Maximum total regular bonus percent
- Default: 50
- Minimum: 0
- Maximum: 100
NoLossExtraBonusPercent
- Description: Extra bonus percent granted when all tracked starting valuables are extracted without any value loss
- Default: 10
- Minimum: 0
- Maximum: 100
ResetStreakOnNonPerfectClear
- Description: Resets streak when the level is cleared without a perfect extraction
- Default: true
- Minimum: false
- Maximum: true
ResetStreakOnLevelFail
- Description: Resets streak when the level fails
- Default: true
- Minimum: false
- Maximum: true
ShowBonusUI
- Description: Shows a bonus UI popup when the reward is granted
- Default: true
- Minimum: false
- Maximum: true
InitialSnapshotDelaySeconds
- Description: Delay after level generation before locking the initial valuable snapshot
- Default: 0.75
- Minimum: 0
- Maximum: 10
LogEnabled
- Description: Enables detailed debug logging
- Default: true
- Minimum: false
- Maximum: true
Technical notes
This mod tracks the initial valuables by object identity, using PhotonView IDs when available and falling back to Unity instance IDs otherwise.
Extraction completion is tracked by patching extraction destruction methods and recording which tracked valuables were actually consumed by extraction.
The extra no-loss bonus tracks each starting valuable's original value and continuously checks whether any tracked starting valuable falls below that value during the level.
Level completion is processed only once per level to avoid duplicate streak resets or duplicate bonus grants.
Bonus percentage configs are integer values only.
All percentage configs are limited to a range of 0 to 100.
If you used an older config file from a previous version that stored percentage values as floats, you may need to delete and regenerate the config file after updating.
Compatibility notes
This mod should work well with mods that:
- change valuable value
- damage valuables
- modify extraction rewards separately
Potential incompatibility can happen with mods that:
- replace valuables with entirely new objects after level start
- remove initial valuables without normal extraction processing
- heavily rewrite extraction internals
- alter original and current valuable value behavior in a non-standard way
PerfectExtractionBonus
PerfectExtractionBonus は R.E.P.O. 向けのホストオンリーMODです
レベル開始時点で存在していた全ての貴重品を納品してからクリアした場合、現在の所持金に対して割合ボーナスを付与します
さらに通常の完全納品ボーナスに加えて、追跡対象の初期貴重品すべてをレベル中に一度も減額させずに納品できた場合、追加ボーナスも付与できます
通常の完全納品ボーナスについては、貴重品が無傷であることまでは要求しません
傷が付いて価値が下がっていても、その同じ元の個体が最終的に納品されれば達成扱いです
追跡対象はレベル開始時点で存在していた貴重品だけです
レベル途中で新たに出現した貴重品は、どちらのボーナス条件にも含みません
機能
- ホストオンリー動作
- 完全納品クリア時に現在所持金ベースの通常ボーナス付与
- 初期貴重品を一度も減額させずに全納品した場合の追加ボーナス付与
- 連続完全納品による通常ボーナス上昇対応
- レベル開始時点の貴重品だけを追跡
- 通常の完全納品は傷付きで価値が下がった貴重品でも納品できれば達成扱い
- 初期貴重品のどれか1つでも価値が初期値を下回ると、そのレベルの追加ボーナス対象外
- 初期スナップショット後に出た貴重品は無視
- レベル結果処理の多重実行防止
- 任意のボーナスUI表示
- 詳細ボーナスログをデフォルトで有効化
仕組み
レベル生成完了後、少し待ってから、その時点で存在する全ての貴重品を初期スナップショットとして確定します
その後は、その初期個体だけをオブジェクト単位で追跡します
納品処理で実際に消費されたとき、その元の個体を納品済みとして記録します
同時に、各初期貴重品の初期価値も記録します
そしてレベル中に、追跡対象の初期貴重品のどれか1つでもその初期価値を下回った場合、そのレベルでは追加ボーナス条件を永久に失います
レベルクリア時に、初期スナップショット内の全貴重品が納品済みかどうかを判定します
達成時
- 通常の完全納品ボーナス付与
- 連続回数を1増加
- さらに一度も減額していなければ追加ボーナスも付与
未達成時
- ボーナスなし
- Config に応じて連続回数リセット
重要な仕様
このMODが見ているのは、レベル開始時点に存在していた貴重品です
その後に追加で出現した貴重品は対象外です
通常の完全納品ボーナスについては、以下でも達成扱いです
- 傷が付いている
- 価格が下がっている
- 価値が減っている
必要なのは、最初に存在していた同じ個体が最終的に納品されることです
追加の無減額ボーナスについては、追跡対象の初期貴重品すべてがレベル中ずっと初期価値以上を維持している必要があります
どれか1つでも一度でも初期価値を下回った時点で、そのレベルの追加ボーナスは失われます
以下は未達成扱いです
- 初期対象だったが最後まで納品されなかった
- 納品ではない別処理で消えた
- 後から別オブジェクトに置き換わった
ホストオンリー
このMODはホストだけ導入すれば動作します
追跡処理、条件判定、連続回数処理、所持金ボーナス処理はすべてホスト側で行われます
参加者側は未導入でも効果自体は動作します
ボーナス計算
通常ボーナス基本式
通常ボーナス = 現在所持金 × 通常ボーナス率
無減額追加ボーナス式
無減額追加ボーナス = 現在所持金 × 無減額追加ボーナス率
最終付与ボーナス
最終付与ボーナス = 通常ボーナス + 無減額追加ボーナス
デフォルト設定の通常ボーナスでは
- 1回目の完全納品クリア: 10%
- 2回連続の完全納品クリア: 15%
- 3回連続の完全納品クリア: 20%
となります
これは連続ボーナスがデフォルトで有効だからです
さらにデフォルト設定の無減額追加ボーナスは
です
デフォルト値での例
- 現在所持金: 10000
- 通常の完全納品ボーナス結果: 15%
- 無減額追加ボーナス: 10%
- 最終ボーナス: 1500 + 1000 = 2500
ログ出力
詳細ボーナスログはデフォルトで有効です
ログ有効時は以下を出力します
- ボーナスが付与されたか
- 無減額追加ボーナスが付与されたか
- 現在の連続回数
- 通常ボーナス率の計算過程
- 無減額追加ボーナス率の計算
- ボーナス金額の計算式
- 合計ボーナス金額の計算
- ボーナス前後の所持金
- 無減額条件を失った理由
設定項目
ModEnabled
- 設定内容: MOD自体の有効無効
- 初期値: true
- 設定可能最小値: false
- 設定可能最大値: true
BaseBonusPercent
- 設定内容: 完全納品クリア時の基本ボーナス率
- 初期値: 10
- 設定可能最小値: 0
- 設定可能最大値: 100
EnableStreakBonus
- 設定内容: 連続完全納品時の追加ボーナス率の有効無効
- 初期値: true
- 設定可能最小値: false
- 設定可能最大値: true
StreakAddPercent
- 設定内容: 2連続目以降に1回ごと加算するボーナス率
- 初期値: 5
- 設定可能最小値: 0
- 設定可能最大値: 100
MaxBonusPercent
- 設定内容: 通常ボーナス率の上限
- 初期値: 50
- 設定可能最小値: 0
- 設定可能最大値: 100
NoLossExtraBonusPercent
- 設定内容: 初期貴重品を一度も減額させずに全納品した場合の追加ボーナス率
- 初期値: 10
- 設定可能最小値: 0
- 設定可能最大値: 100
ResetStreakOnNonPerfectClear
- 設定内容: 通常クリアだが完全納品でない場合に連続回数をリセットするか
- 初期値: true
- 設定可能最小値: false
- 設定可能最大値: true
ResetStreakOnLevelFail
- 設定内容: レベル失敗時に連続回数をリセットするか
- 初期値: true
- 設定可能最小値: false
- 設定可能最大値: true
ShowBonusUI
- 設定内容: ボーナス付与時にUI表示を行うか
- 初期値: true
- 設定可能最小値: false
- 設定可能最大値: true
InitialSnapshotDelaySeconds
- 設定内容: レベル生成後に初期貴重品スナップショットを確定するまでの待機秒数
- 初期値: 0.75
- 設定可能最小値: 0
- 設定可能最大値: 10
LogEnabled
- 設定内容: 詳細デバッグログの出力有無
- 初期値: true
- 設定可能最小値: false
- 設定可能最大値: true
技術メモ
このMODは、初期貴重品をオブジェクト単位で追跡します
PhotonView ID が使える場合はそれを優先し、使えない場合は Unity の Instance ID を使います
納品達成は、納品処理で実際に消費された貴重品だけを extraction patch から記録して判定しています
無減額追加ボーナスは、各初期貴重品の初期価値を記録し、レベル中にその値を下回ったかどうかを継続監視して判定しています
レベル結果処理は1レベル1回だけ通すようにしており、二重ボーナスや二重リセットを防いでいます
ボーナス率系Configはすべて整数値です
すべてのパーセンテージConfigは 0 から 100 の範囲に制限されています
旧バージョンの cfg に小数型のパーセンテージ設定が残っている場合は、更新後に cfg を削除して再生成が必要になることがあります
互換性メモ
以下のようなMODとは相性が良いです
- 貴重品の価値変更
- 貴重品へのダメージ追加
- 納品報酬変更
以下のようなMODとは競合可能性があります
- レベル開始後に初期貴重品を別オブジェクトへ差し替える
- 通常の納品処理を通さずに初期貴重品を削除する
- 納品内部処理を大きく作り変える
- 初期価値や現在価値の扱いを大きく変更する