REPO_JP-SharedLiabilityDamage icon

SharedLiabilityDamage

Host-only solidarity damage: whenever someone dies, deal N% of each survivor's max health to every survivor, without re-triggering on solidarity-caused deaths (0 disables).誰かが死ぬたびに生存者全員へ最大体力N%ダメージ付与 連帯責任ダメージ死では再発動しない(0で無効 ホストのみ)

By REPO_JP
Last updated 12 hours ago
Total downloads 48
Total rating 1 
Categories Mods Server-side
Dependency string REPO_JP-SharedLiabilityDamage-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2304 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2304

README

SharedLiabilityDamage

  • Host-only solidarity damage: whenever someone dies, deal N% of each survivor's max health to every survivor (no re-trigger on solidarity-caused deaths)

Overview

  • What this mod does

    • Hooks PlayerAvatar.PlayerDeathRPC
    • When any player dies, the host deals damage to every survivor based on that survivor’s own max health
    • Prevents chain-trigger when a death was caused by the mod’s solidarity damage
  • Who it is for

    • Hosts who want a simple “shared liability” rule where deaths punish all survivors
  • What changes after installation

    • On each death event, survivors take N% of their own max health as damage
    • Deaths caused by this mod do not trigger the effect again

Features

  • Host-only execution

    • Runs only in multiplayer (GameManager.Multiplayer())
    • Runs only on the Master Client (PhotonNetwork.IsMasterClient)
    • Non-host clients do not run the logic
  • Per-survivor damage

    • Enumerates PlayerAvatar via Object.FindObjectsOfType<PlayerAvatar>()
    • For each survivor, reads PlayerHealth.maxHealth and calculates damage per survivor
    • Damage formula: RoundToInt(maxHealth * (N / 100)) clamped to 1..maxHealth
  • 1-frame delay for safety

    • Uses a coroutine and yield return null to run after RPC processing
  • Damage application

    • Applies damage via PlayerHealth.HurtOther(damage, Vector3.zero, false, enemyIndex: -1)
    • Uses enemyIndex = -1 to tag “solidarity-caused” damage events
  • No re-trigger on solidarity-caused deaths (anti loop)

    • If PlayerDeathRPC arrives with enemyIndex == -1 and the dead player was recently marked, the effect is skipped
    • Marks are stored per player using photonView.ViewID
    • Mark TTL is 2 seconds
    • Expired marks are purged before applying damage

Configuration

  • General.DamagePercent

    • Default: 10
    • Range: 0..100
    • Meaning: each death deals N% of each survivor’s max health to that survivor
    • 0 disables the mod

Usage

  • Minimal steps

    • Install the mod on the host
    • Start a multiplayer session as the Master Client (host)
    • Set General.DamagePercent
    • When any player dies, survivors take solidarity damage automatically
  • Notes

    • Works only for the host (Master Client)
    • This mod is designed for multiplayer (it exits when not multiplayer)

Contact


SharedLiabilityDamage

  • 誰かが死ぬたびに 生存者全員へ 生存者ごとの最大体力N%ダメージ付与するホスト専用MOD(連帯責任ダメージ死では再発動しない)

概要

  • このMODが何をするか

    • PlayerAvatar.PlayerDeathRPC をフック
    • 誰かが死んだら ホストが生存者全員へ 生存者ごとの最大体力N%ダメージを付与
    • 連帯責任ダメージが原因の死亡では 連帯責任を再発動しない
  • どんな人向けか

    • 「1人の死亡が全体に影響する」ルールをシンプルに入れたいホスト向け
  • 導入で何が変わるか

    • 死亡イベントのたびに 生存者は各自の最大体力N%分のダメージを受ける
    • 連帯責任ダメージ由来の死亡では連鎖発動しない

特徴

  • ホスト専用動作

    • GameManager.Multiplayer() が true のときのみ動作
    • PhotonNetwork.IsMasterClient(ホスト)のときのみ動作
    • 非ホスト参加者では動作しない
  • 生存者ごとのダメージ計算

    • Object.FindObjectsOfType<PlayerAvatar>() でプレイヤー列挙
    • 各生存者の PlayerHealth.maxHealth を基準に 個別にダメージ算出
    • 算出式: RoundToInt(maxHealth * (N / 100))1..maxHealth にクランプ
  • 1フレーム遅延

    • RPC内処理との干渉回避のため コルーチンで yield return null
  • ダメージ付与方法

    • PlayerHealth.HurtOther(damage, Vector3.zero, false, enemyIndex: -1) で付与
    • enemyIndex = -1 を「連帯責任ダメージ」の目印として使用
  • 連帯責任ダメージ死で再発動しない(ループ防止)

    • enemyIndex == -1 の死亡 かつ 直前にマーク済みなら発動をスキップ
    • マークは photonView.ViewID 単位で保持
    • マーク保持時間は2秒
    • 期限切れマークは掃除してから処理

設定

  • General.DamagePercent

    • 既定値: 10
    • 範囲: 0..100
    • 意味: 死亡1回ごとに 生存者それぞれの最大体力N%をその生存者に付与
    • 0 は無効化

使い方

  • 最短手順

    • ホストにMODを導入
    • マスタークライアント(ホスト)としてマルチプレイを開始
    • General.DamagePercent を設定
    • 誰かが死ぬと 生存者全員へ自動で連帯責任ダメージが入る
  • 注意点

    • 動作するのはホストのみ
    • 本実装はマルチプレイ専用(シングルプレイでは処理を行わない)

連絡先