|
| 1 | +using Exiled.Events.EventArgs.Player; |
| 2 | +using PlayerRoles; |
| 3 | +using System.Collections.Generic; |
| 4 | + |
1 | 5 | namespace Server_NapCha_ui_API |
2 | 6 | { |
| 7 | + // 处理伤害事件的类 |
3 | 8 | public class FileName0 |
4 | 9 | { |
| 10 | + // 处理伤害的具体方法 |
5 | 11 | public void 伤害处理程序(HurtingEventArgs hut) // 伤害处理程序 |
6 | 12 | { |
7 | | - if(hut.Attacker == null || hut.Player == null) |
| 13 | + if (hut.Attacker == null || hut.Player == null) |
8 | 14 | { |
9 | 15 | return; |
10 | 16 | } |
11 | | - if (Server_NapCha_API.SCPs.Contains(hut.Player) && hut.Attacker.Role.Team == Team.SCPs || Server_NapCha_API.SCPs.Contains(hut.Attacker) && hut.Player.Role.Team == Team.SCPs || Server_NapCha_API.SCPs.Contains(hut.Attacker)&& Server_NapCha_API.SCPs.Contains(hut.Player)) |
| 17 | + |
| 18 | + bool isAttackerSCP = Server_NapCha_API.Server_NapCha_API.SCPs.Contains(hut.Attacker); |
| 19 | + bool isPlayerSCP = Server_NapCha_API.Server_NapCha_API.SCPs.Contains(hut.Player); |
| 20 | + bool isAttackerNTF = Server_NapCha_API.Server_NapCha_API.ntf.Contains(hut.Attacker); |
| 21 | + bool isPlayerNTF = Server_NapCha_API.Server_NapCha_API.ntf.Contains(hut.Player); |
| 22 | + bool isAttackerCS = Server_NapCha_API.Server_NapCha_API.cs.Contains(hut.Attacker); |
| 23 | + bool isPlayerCS = Server_NapCha_API.Server_NapCha_API.cs.Contains(hut.Player); |
| 24 | + bool isAttackerZL = Server_NapCha_API.Server_NapCha_API.zl.Contains(hut.Attacker); |
| 25 | + bool isPlayerZL = Server_NapCha_API.Server_NapCha_API.zl.Contains(hut.Player); |
| 26 | + bool isAttackerNoDamage = Server_NapCha_API.Server_NapCha_API.无伤害.Contains(hut.Attacker); |
| 27 | + |
| 28 | + // 根据不同团队的攻击者和玩家的角色决定是否允许伤害 |
| 29 | + if ((isPlayerSCP && hut.Attacker.Role.Team == Team.SCPs) || |
| 30 | + (isAttackerSCP && hut.Player.Role.Team == Team.SCPs) || |
| 31 | + (isAttackerSCP && isPlayerSCP)) |
12 | 32 | { |
13 | 33 | hut.IsAllowed = false; |
14 | 34 | } |
15 | | - if (Server_NapCha_API.ntf.Contains(hut.Player) && hut.Attacker.Role.Team == Team.FoundationForces || Server_NapCha_API.ntf.Contains(hut.Attacker) && hut.Player.Role.Team == Team.FoundationForces || Server_NapCha_API.ntf.Contains(hut.Attacker) && Server_NapCha_API.ntf.Contains(hut.Player)) |
| 35 | + else if ((isPlayerNTF && hut.Attacker.Role.Team == Team.FoundationForces) || |
| 36 | + (isAttackerNTF && hut.Player.Role.Team == Team.FoundationForces) || |
| 37 | + (isAttackerNTF && isPlayerNTF)) |
16 | 38 | { |
17 | 39 | hut.IsAllowed = false; |
18 | 40 | } |
19 | | - if (Server_NapCha_API.cs.Contains(hut.Player) && hut.Attacker.Role.Team == Team.ChaosInsurgency || Server_NapCha_API.cs.Contains(hut.Attacker) && hut.Player.Role.Team == Team.ChaosInsurgency || Server_NapCha_API.cs.Contains(hut.Attacker) && Server_NapCha_API.cs.Contains(hut.Player)) |
| 41 | + else if ((isPlayerCS && hut.Attacker.Role.Team == Team.ChaosInsurgency) || |
| 42 | + (isAttackerCS && hut.Player.Role.Team == Team.ChaosInsurgency) || |
| 43 | + (isAttackerCS && isPlayerCS)) |
20 | 44 | { |
21 | 45 | hut.IsAllowed = false; |
22 | 46 | } |
23 | | - if(Server_NapCha_API.zl.Contains(hut.Player) && hut.Attacker != null || Server_NapCha_API.zl.Contains(hut.Attacker)) |
| 47 | + else if ((isPlayerZL && hut.Attacker != null) || isAttackerZL) |
24 | 48 | { |
25 | 49 | hut.IsAllowed = false; |
26 | 50 | } |
27 | | - if(Server_NapCha_API.无伤害.Contains(hut.Attacker)) |
| 51 | + else if (isAttackerNoDamage) |
28 | 52 | { |
29 | 53 | hut.IsAllowed = true; |
30 | 54 | } |
31 | 55 | } |
32 | 56 | } |
| 57 | +} |
0 commit comments