Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit 38d501e

Browse files
committed
fix aimbot
1 parent f38f850 commit 38d501e

2 files changed

Lines changed: 61 additions & 60 deletions

File tree

BmMod.cs

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -557,57 +557,60 @@ void AimBot()
557557
Transform ResTran = null; //储存Transform结果
558558
foreach (var monster in monsters)
559559
{
560-
if (monster.playerProp.HP == 1 && monster.BloodBarCom.BloodBar.HolaName == "不朽的") { continue; } // 无敌怪
561-
Transform weakTrans;
560+
//MainMod.Log.LogWarning("isSpecialUndieChallenge " + monster.BloodBarCom.BloodBar.isSpecialUndieChallenge);
561+
//MainMod.Log.LogWarning("isUndieChallenge " + monster.BloodBarCom.BloodBar.isUndieChallenge);
562+
//MainMod.Log.LogWarning("isUndieStart " + monster.BloodBarCom.BloodBar.isUndieStart);
563+
//MainMod.Log.LogWarning("isUndieStart " + monster.BloodBarCom.BloodBar.m_UndieMonsterBar);
564+
//MainMod.Log.LogWarning("isUndieStart " + monster.BloodBarCom.BloodBar.m_UndieChallengeBar);
565+
if (monster.playerProp.HP == 1 && (monster.BloodBarCom.BloodBar.isSpecialUndieChallenge || monster.BloodBarCom.BloodBar.isUndieChallenge || monster.BloodBarCom.BloodBar.isUndieStart)) { continue; } // 无敌怪
562566
try
563567
{
564-
weakTrans = monster.BodyPartCom.GetWeakTrans(false);
565-
}
566-
catch
567-
{
568-
continue;
569-
}
570-
571-
if (weakTrans != null)
572-
{
573-
Vector3 vector = CameraManager.MainCameraCom.WorldToViewportPoint(weakTrans.position); // 转二维坐标
574-
if (vector.z <= 0) { continue; } // 忽略身后目标
575-
float CenterDistance = Vector3.Distance(new Vector3(0.5f, 0.5f, 0), new Vector3(vector.x, vector.y, 0)); // 计算目标与准星距离
576-
577-
vector = weakTrans.position - HeroPos;
578-
float Distance = vector.magnitude;
579-
if (Distance <= AimBotForceDistance)
580-
{
581-
DistanceFlag = true;
582-
}
583-
else if (CenterDistance > AimBotSightRange)
568+
Transform weakTrans = monster.BodyPartCom.GetWeakTrans(false);
569+
if (weakTrans != null)
584570
{
585-
continue;
586-
}
571+
Vector3 vector = CameraManager.MainCameraCom.WorldToViewportPoint(weakTrans.position); // 转二维坐标
572+
if (vector.z <= 0) { continue; } // 忽略身后目标
573+
float CenterDistance = Vector3.Distance(new Vector3(0.5f, 0.5f, 0), new Vector3(vector.x, vector.y, 0)); // 计算目标与准星距离
587574

588-
//发射射线查看是否有阻挡
589-
Ray ray = new Ray(HeroPos, vector);
590-
var hits = Physics.RaycastAll(ray, Distance);
591-
//开启了破坏护盾功能并存在护盾 执行ZoomShield
592-
if (AimBotShieldState && hits.Any(hit => hit.collider.gameObject.tag == "Monster_Shield")) { ZoomShield(); }
593-
//查询是否存在阻挡
594-
bool query = hits.Any(hit => hit.collider.gameObject.layer == 0 || hit.collider.gameObject.layer == 30 || hit.collider.gameObject.layer == 31 || hit.collider.gameObject.tag == "Monster_Shield");
595-
if (query) { continue; }
575+
vector = weakTrans.position - HeroPos;
576+
float Distance = vector.magnitude;
577+
if (Distance <= AimBotForceDistance)
578+
{
579+
DistanceFlag = true;
580+
}
581+
else if (CenterDistance > AimBotSightRange)
582+
{
583+
continue;
584+
}
596585

597-
//找到最近的敌人
598-
if (DistanceFlag)
599-
{
600-
if (Distance < DistanceRange)
586+
//发射射线查看是否有阻挡
587+
Ray ray = new Ray(HeroPos, vector);
588+
var hits = Physics.RaycastAll(ray, Distance);
589+
//开启了破坏护盾功能并存在护盾 执行ZoomShield
590+
if (AimBotShieldState && hits.Any(hit => hit.collider.gameObject.tag == "Monster_Shield")) { ZoomShield(); }
591+
//查询是否存在阻挡
592+
bool query = hits.Any(hit => hit.collider.gameObject.layer == 0 || hit.collider.gameObject.layer == 30 || hit.collider.gameObject.layer == 31 || hit.collider.gameObject.tag == "Monster_Shield");
593+
if (query) { continue; }
594+
595+
//找到最近的敌人
596+
if (DistanceFlag)
601597
{
602-
DistanceRange = Distance;
598+
if (Distance < DistanceRange)
599+
{
600+
DistanceRange = Distance;
601+
ResTran = weakTrans;
602+
}
603+
}
604+
else if (CenterDistance < CenterRange)
605+
{
606+
CenterRange = CenterDistance;
603607
ResTran = weakTrans;
604608
}
605609
}
606-
else if (CenterDistance < CenterRange)
607-
{
608-
CenterRange = CenterDistance;
609-
ResTran = weakTrans;
610-
}
610+
}
611+
catch
612+
{
613+
continue;
611614
}
612615
}
613616
if (ResTran != null)
@@ -654,30 +657,29 @@ void AimBotPlus()
654657
float SightRange = 9999999;
655658
foreach (var monster in monsters)
656659
{
657-
if (monster.playerProp.HP == 1 && monster.BloodBarCom.BloodBar.HolaName == "不朽的") { continue; } // 无敌怪
658-
Transform weakTrans;
660+
if (monster.playerProp.HP == 1 && (monster.BloodBarCom.BloodBar.isSpecialUndieChallenge || monster.BloodBarCom.BloodBar.isUndieChallenge || monster.BloodBarCom.BloodBar.isUndieStart)) { continue; } // 无敌怪
659661
try
660662
{
661-
weakTrans = monster.BodyPartCom.GetWeakTrans(false);
663+
Transform weakTrans = monster.BodyPartCom.GetWeakTrans(false);
664+
if (weakTrans != null)
665+
{
666+
Vector3 vector = weakTrans.position - position;
667+
float Distance = vector.magnitude;
668+
Ray ray = new Ray(position, vector);
669+
var hits = Physics.RaycastAll(ray, Distance);
670+
if (hits.Any(hit => hit.collider.gameObject.tag == "Monster_Shield")) { ZoomShield(); }
671+
bool query = hits.Any(hit => hit.collider.gameObject.layer == 0 || hit.collider.gameObject.layer == 30 || hit.collider.gameObject.layer == 31 || hit.collider.gameObject.tag == "Monster_Shield");
672+
if (!query && Distance < SightRange)
673+
{
674+
SightRange = Distance;
675+
transform = weakTrans;
676+
}
677+
}
662678
}
663679
catch
664680
{
665681
continue;
666682
}
667-
if (weakTrans != null)
668-
{
669-
Vector3 vector = weakTrans.position - position;
670-
float Distance = vector.magnitude;
671-
Ray ray = new Ray(position, vector);
672-
var hits = Physics.RaycastAll(ray, Distance);
673-
if (hits.Any(hit => hit.collider.gameObject.tag == "Monster_Shield")) { ZoomShield(); }
674-
bool query = hits.Any(hit => hit.collider.gameObject.layer == 0 || hit.collider.gameObject.layer == 30 || hit.collider.gameObject.layer == 31 || hit.collider.gameObject.tag == "Monster_Shield");
675-
if (!query && Distance < SightRange)
676-
{
677-
SightRange = Distance;
678-
transform = weakTrans;
679-
}
680-
}
681683
}
682684
if (transform != null)
683685
{

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ https://builds.bepis.io/projects/bepinex_be
1919
目前已知问题
2020
大部分武器修改高射速,无效。
2121
手套武器,无法“转起来”。
22-
自瞄会锁暴躁怪。
2322

2423
只在steam平台测试过,wegame平台是否能使用,自行测试。
2524

0 commit comments

Comments
 (0)