From 589ed88a5924a7494e21b95b6bbff5e46ff49ddd Mon Sep 17 00:00:00 2001
From: asmrobot <asmrobot@hotmail.com>
Date: Thu, 21 Nov 2019 01:08:42 +0000
Subject: [PATCH] kalete map
---
src/RichCreator/Utilitys/AttackRectangle.cs | 41 +++++++++++++++++++++--------------------
1 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/src/RichCreator/Utilitys/AttackRectangle.cs b/src/RichCreator/Utilitys/AttackRectangle.cs
index d9b47dc..f6e4653 100644
--- a/src/RichCreator/Utilitys/AttackRectangle.cs
+++ b/src/RichCreator/Utilitys/AttackRectangle.cs
@@ -8,6 +8,7 @@
using System.Threading.Tasks;
using RichCreator.Utility.Skills;
using RichCreator.Utility.Maps;
+using RichCreator.Utility.Utilitys;
namespace RichCreator.Utilitys
{
@@ -26,20 +27,20 @@
/// <param name="direction"></param>
/// <param name="needMove"></param>
/// <returns></returns>
- public static ZTSize GetMoveDistance(ZTRectangle gameRect,ZTPoint rolePosition, ZTPoint[] monsterPositions, SkillInfo skill,out HIDCode direction, out bool needMove)
+ public static ZTPoint GetAttackPoint(ZTRectangle gameRect,ZTPoint rolePosition, ZTPoint[] monsterPositions, SkillInfo skill,out HIDCode direction, out bool needMove)
{
needMove = false;
- ZTSize moveDistance = ZTSize.Empty;
+
if (monsterPositions.Length <= 1||skill.MovePriority==MovePriority.Nearly)
{
- moveDistance = GetAttackRectangleByNear(monsterPositions, rolePosition, skill, out direction, out needMove);
+ return GetAttackPointByNear(monsterPositions, rolePosition, skill, out direction, out needMove);
}
else
{
- moveDistance = GetAttackRectangleByQuantity(gameRect,monsterPositions, rolePosition, skill, out direction, out needMove);
+ return GetAttackPointByQuantity(gameRect,monsterPositions, rolePosition, skill, out direction, out needMove);
}
- return moveDistance;
+
}
@@ -49,11 +50,11 @@
/// 得到最近的攻击目标距离
/// </summary>
/// <returns></returns>
- private static ZTSize GetAttackRectangleByNear(ZTPoint[] monsterPositions, ZTPoint rolePosition, SkillInfo skill,out HIDCode direction, out bool needMove)
+ private static ZTPoint GetAttackPointByNear(ZTPoint[] monsterPositions, ZTPoint rolePosition, SkillInfo skill,out HIDCode direction, out bool needMove)
{
needMove = true;
direction = HIDCode.RightArrow;
- ZTRectangle attackRect = new ZTRectangle(rolePosition.X - skill.Range.Width, rolePosition.Y - skill.Range.Height / 2, rolePosition.X + skill.Range.Width, rolePosition.Y + skill.Range.Height / 2);//攻击范围
+ ZTRectangle attackRange = new ZTRectangle(rolePosition.X - skill.Range.Width, rolePosition.Y - skill.Range.Height / 2, rolePosition.X + skill.Range.Width, rolePosition.Y + skill.Range.Height / 2);//攻击范围
//switch (skill.ReleaseAnchor)
//{
// case SkillInfo.SkillAnchor.Side:
@@ -76,11 +77,11 @@
if (index == 0)
{
- nearDistance = Utils.GetDistance(monsterPositions[index], rolePosition);
+ nearDistance = GeoHelper.GetDistance(monsterPositions[index], rolePosition);
nearMonsterPosition = monsterPositions[index];
}
//天然就在攻击范围内
- if (Utils.IsInRect(monsterPositions[index], attackRect))
+ if (GeoHelper.IsInRect(monsterPositions[index], attackRange))
{
needMove = false;
break;
@@ -91,7 +92,7 @@
}
//计算远近
- double distance = Utils.GetDistance(monsterPositions[index], rolePosition);
+ double distance = GeoHelper.GetDistance(monsterPositions[index], rolePosition);
if (distance < nearDistance)
{
nearDistance = distance;
@@ -145,7 +146,7 @@
}
- return moveDistance;
+ return new ZTPoint(rolePosition.X+moveDistance.Width,rolePosition.Y+moveDistance.Height);
}
@@ -157,7 +158,7 @@
/// <param name="monsterPositions"></param>
/// <param name="yRange"></param>
/// <returns></returns>
- private static ZTSize GetAttackRectangleByQuantity(ZTRectangle gameRect,ZTPoint[] monsterPositions, ZTPoint rolePosition, SkillInfo skill,out HIDCode direction, out bool needMove)
+ private static ZTPoint GetAttackPointByQuantity(ZTRectangle gameRect,ZTPoint[] monsterPositions, ZTPoint rolePosition, SkillInfo skill,out HIDCode direction, out bool needMove)
{
needMove = true;
direction = HIDCode.RightArrow;
@@ -198,7 +199,7 @@
Int32 top = 0, right = 0,bottom = 0,left = 0;
for (int i = 0; i < monsterPositions.Length; i++)
{
- if (Utils.IsInRect(monsterPositions[i], monsterRect))
+ if (GeoHelper.IsInRect(monsterPositions[i], monsterRect))
{
ZTPoint monsterPoint = monsterPositions[i];
if (i == 0)
@@ -256,8 +257,8 @@
//两边发技能
ZTPoint leftAttackPosition = new ZTPoint(Math.Max(gameRect.Start.X,left+skill.AnchorOffset.Width),Math.Max(top, bottom + skill.AnchorOffset.Height));
ZTPoint rightAttackPosition = new ZTPoint(Math.Min(gameRect.End.X,right+skill.AnchorOffset.Width), Math.Max(top,bottom + skill.AnchorOffset.Height));
- double toLeft = Utils.GetDistance(leftAttackPosition, rolePosition);
- double toRight = Utils.GetDistance(rightAttackPosition, rolePosition);
+ double toLeft = GeoHelper.GetDistance(leftAttackPosition, rolePosition);
+ double toRight = GeoHelper.GetDistance(rightAttackPosition, rolePosition);
//计算可以发技能的区域
if (toLeft <= toRight)
@@ -286,15 +287,15 @@
}
}
- if (Utils.IsInRect(rolePosition, releaseSkillRect))
+ if (GeoHelper.IsInRect(rolePosition, releaseSkillRect))
{
needMove = false;
}
-
- //转换为移动距离
- return new ZTSize ( releaseSkillPosition.X-rolePosition.X,releaseSkillPosition.Y-rolePosition.Y);
+ return releaseSkillPosition;
+ ////转换为移动距离
+ //return new ZTSize ( releaseSkillPosition.X-rolePosition.X,releaseSkillPosition.Y-rolePosition.Y);
}
@@ -312,7 +313,7 @@
int count = 0;
for (int i = 0; i < monsterPositions.Length; i++)
{
- if (Utils.IsInRect(monsterPositions[i], rect))
+ if (GeoHelper.IsInRect(monsterPositions[i], rect))
{
count++;
}
--
Gitblit v1.9.3