//物理攻撃のダメージ処理 public void DirectAttack() { var damage = 0; // 攻撃相手のStatus if (targetBaseStatus as AllyStatus != null) { var castedTargetStatus = (AllyStatus)targetCharacterBattleScript.GetCharacterStatus(); // 攻撃相手の通常の防御力+相手のキャラの補助値 var targetDefencePower = castedTargetStatus.GetStrikingStrength() + (castedTargetStatus.GetEquipArmor()?.GetAmount() ?? 0); damage = Mathf.Max(0, (baseStatus.GetPower() * auxiliaryPower) - targetDefencePower * targetCharacterBattleScript.GetAuxiliaryStrikingStrength()); battleManager.ShowMessage(currentTarget.name + "は" + damage + "のダメージを受けた。"); // 相手のステータスのHPをセット targetCharacterBattleScript.SetHp(targetCharacterBattleScript.GetHp() - damage); // ステータスUIを更新 battleStatusScript.UpdateStatus(targetBaseStatus, BattleStatus.Status.HP, targetCharacterBattleScript.GetHp()); } else if (targetBaseStatus as EnemyStatus != null) { var castedTargetStatus = (EnemyStatus)targetCharacterBattleScript.GetCharacterStatus(); // 攻撃相手の通常の防御力+相手のキャラの補助値 var targetDefencePower = castedTargetStatus.GetStrikingStrength() * targetCharacterBattleScript.GetAuxiliaryStrikingStrength(); damage = Mathf.Max(0, (baseStatus.GetPower() + (((AllyStatus)baseStatus).GetEquipWeapon()?.GetAmount() ?? 0) * auxiliaryPower) - targetDefencePower); battleManager.ShowMessage(currentTarget.name + "は" + damage + "のダメージを受けた。"); // 敵のステータスのHPをセット targetCharacterBattleScript.SetHp(targetCharacterBattleScript.GetHp() - damage); } }