Skip to content

Commit 3c1a6c9

Browse files
authored
Update FileName0
1 parent c09df1c commit 3c1a6c9

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

FileName0

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,57 @@
1+
using Exiled.Events.EventArgs.Player;
2+
using PlayerRoles;
3+
using System.Collections.Generic;
4+
15
namespace Server_NapCha_ui_API
26
{
7+
// 处理伤害事件的类
38
public class FileName0
49
{
10+
// 处理伤害的具体方法
511
public void 伤害处理程序(HurtingEventArgs hut) // 伤害处理程序
612
{
7-
if(hut.Attacker == null || hut.Player == null)
13+
if (hut.Attacker == null || hut.Player == null)
814
{
915
return;
1016
}
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))
1232
{
1333
hut.IsAllowed = false;
1434
}
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))
1638
{
1739
hut.IsAllowed = false;
1840
}
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))
2044
{
2145
hut.IsAllowed = false;
2246
}
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)
2448
{
2549
hut.IsAllowed = false;
2650
}
27-
if(Server_NapCha_API.无伤害.Contains(hut.Attacker))
51+
else if (isAttackerNoDamage)
2852
{
2953
hut.IsAllowed = true;
3054
}
3155
}
3256
}
57+
}

0 commit comments

Comments
 (0)