|
@@ -53,26 +53,26 @@ namespace CommonAI.Zone.Instance
|
|
|
|
|
|
private float mMoveDistance;
|
|
|
|
|
|
- //服务器专用的扩展字段
|
|
|
- private int actionIndex;
|
|
|
+ //服务器专用的扩展字段
|
|
|
+ private int actionIndex;
|
|
|
private int mMaxAffectUnit;
|
|
|
- //法术创建时,玩家的AOI状态
|
|
|
- private byte aoiFlag = 0;
|
|
|
+ //法术创建时,玩家的AOI状态
|
|
|
+ private byte aoiFlag = 0;
|
|
|
|
|
|
- //每隔N秒触发,触发次数
|
|
|
- private int mHitTotalTimes;
|
|
|
+ //每隔N秒触发,触发次数
|
|
|
+ private int mHitTotalTimes;
|
|
|
|
|
|
- //法术总时长
|
|
|
- private readonly int mSpellTotalTime; //法术的总时长
|
|
|
+ //法术总时长
|
|
|
+ private readonly int mSpellTotalTime; //法术的总时长
|
|
|
|
|
|
- // 飞弹各种奇葩数据记录, 法术数量可控
|
|
|
- private JSGCreateSpellData mCreateSpellData; //法术创建信息(可变的,由技能数据确定)
|
|
|
- // 飞弹不同的法术id
|
|
|
- public List<LaunchSpell> mCurveSpellList;
|
|
|
- //连续飞弹
|
|
|
- private byte mCurveSpellIndex;
|
|
|
+ // 飞弹各种奇葩数据记录, 法术数量可控
|
|
|
+ private JSGCreateSpellData mCreateSpellData; //法术创建信息(可变的,由技能数据确定)
|
|
|
+ // 飞弹不同的法术id
|
|
|
+ public List<LaunchSpell> mCurveSpellList;
|
|
|
+ //连续飞弹
|
|
|
+ private byte mCurveSpellIndex;
|
|
|
|
|
|
- private TVector2 mPrvePos = new TVector2();
|
|
|
+ private TVector2 mPrvePos = new TVector2();
|
|
|
|
|
|
public InstanceSpell(
|
|
|
InstanceZone zone,
|
|
@@ -80,44 +80,44 @@ namespace CommonAI.Zone.Instance
|
|
|
LaunchSpell launch,
|
|
|
InstanceUnit launcher,
|
|
|
InstanceZoneObject sender,
|
|
|
- Dictionary<uint, InstanceUnit> damageList,
|
|
|
- XmdsSkillType fromSkillType = XmdsSkillType.none,
|
|
|
- int spellIndex = 0,
|
|
|
- JSGCreateSpellData createData = null)
|
|
|
+ Dictionary<uint, InstanceUnit> damageList,
|
|
|
+ XmdsSkillType fromSkillType = XmdsSkillType.none,
|
|
|
+ int spellIndex = 0,
|
|
|
+ JSGCreateSpellData createData = null)
|
|
|
: base(zone, false)
|
|
|
{
|
|
|
- this.mSpellTotalTime = data.LifeTimeMS;
|
|
|
- this.mCurveSpellIndex = (byte)spellIndex;
|
|
|
+ this.mSpellTotalTime = data.LifeTimeMS;
|
|
|
+ this.mCurveSpellIndex = (byte)spellIndex;
|
|
|
|
|
|
- SenderID = 0;
|
|
|
- if(sender!=null)
|
|
|
+ SenderID = 0;
|
|
|
+ if (sender != null)
|
|
|
{
|
|
|
if (sender is InstanceUnit)
|
|
|
SenderID = sender.ID;
|
|
|
- else if(sender is InstanceSpell)
|
|
|
+ else if (sender is InstanceSpell)
|
|
|
SenderID = (sender as InstanceSpell).SenderID;
|
|
|
}
|
|
|
|
|
|
- //记录AOI状态
|
|
|
- if(sender.AoiStatus != null)
|
|
|
- {
|
|
|
- this.aoiFlag = 1;
|
|
|
- }
|
|
|
+ //记录AOI状态
|
|
|
+ if (sender.AoiStatus != null)
|
|
|
+ {
|
|
|
+ this.aoiFlag = 1;
|
|
|
+ }
|
|
|
|
|
|
this.FromSkillType = fromSkillType;
|
|
|
this.mLaunchData = launch;
|
|
|
- if(createData == null)
|
|
|
- {
|
|
|
- this.mCreateSpellData = new JSGCreateSpellData();
|
|
|
- this.mCreateSpellData.mMaxSpellCount = launch.Count;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- this.mCreateSpellData = createData;
|
|
|
- }
|
|
|
-
|
|
|
+ if (createData == null)
|
|
|
+ {
|
|
|
+ this.mCreateSpellData = new JSGCreateSpellData();
|
|
|
+ this.mCreateSpellData.mMaxSpellCount = launch.Count;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this.mCreateSpellData = createData;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- this.mKeyFrames = new PopupKeyFrames<SpellTemplate.KeyFrame>();
|
|
|
+ this.mKeyFrames = new PopupKeyFrames<SpellTemplate.KeyFrame>();
|
|
|
this.mKeyFrames.AddRange(data.KeyFrames);
|
|
|
this.mInfo = data;
|
|
|
this.mLauncherUnit = launcher;
|
|
@@ -137,11 +137,11 @@ namespace CommonAI.Zone.Instance
|
|
|
this.mSyncPos = zone.SyncPos;
|
|
|
this.mHitIntervalTicker = new TimeInterval<SpellTemplate.KeyFrame>(data.HitIntervalMS);
|
|
|
this.mHitIntervalTicker.Tag = data.HitIntervalKeyFrame;
|
|
|
- this.mHitTotalTimes = 0;
|
|
|
- this.AttackRange = new AttackRangeHelper(launcher);
|
|
|
+ this.mHitTotalTimes = 0;
|
|
|
+ this.AttackRange = new AttackRangeHelper(launcher);
|
|
|
this.mSpeed = mInfo.MSpeedSEC;
|
|
|
this.mMoveDistance = 0;
|
|
|
- if(launcher.AoiStatus != null)
|
|
|
+ if (launcher.AoiStatus != null)
|
|
|
{
|
|
|
this.setAoiStatus(launcher.AoiStatus);
|
|
|
}
|
|
@@ -149,10 +149,10 @@ namespace CommonAI.Zone.Instance
|
|
|
public SpellTemplate Info { get { return mInfo; } }
|
|
|
public LaunchSpell LaunchData { get { return mLaunchData; } }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 最先技能的发起者
|
|
|
- /// </summary>
|
|
|
- public InstanceUnit Launcher { get { return mLauncherUnit; } }
|
|
|
+ /// <summary>
|
|
|
+ /// 最先技能的发起者
|
|
|
+ /// </summary>
|
|
|
+ public InstanceUnit Launcher { get { return mLauncherUnit; } }
|
|
|
public uint LauncherID { get { return mLauncherUnit.ID; } }
|
|
|
/// <summary>
|
|
|
/// 技能的出口,比如技能触发技能,则Sender就是一个Spell
|
|
@@ -169,15 +169,15 @@ namespace CommonAI.Zone.Instance
|
|
|
public override bool ClientVisible { get { return mClientVisible; } }
|
|
|
public override bool SyncPos { get { return mSyncPos; } }
|
|
|
|
|
|
- public int BindActionIndex {get{ return actionIndex; } set { this.actionIndex = value; } }
|
|
|
+ public int BindActionIndex { get { return actionIndex; } set { this.actionIndex = value; } }
|
|
|
|
|
|
public int MaxAffectUnit { get { return mMaxAffectUnit; } set { this.mMaxAffectUnit = value; } }
|
|
|
|
|
|
- /** 获取触发次数 */
|
|
|
- public int GetHitTimes()
|
|
|
- {
|
|
|
- return this.mHitTotalTimes;
|
|
|
- }
|
|
|
+ /** 获取触发次数 */
|
|
|
+ public int GetHitTimes()
|
|
|
+ {
|
|
|
+ return this.mHitTotalTimes;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 连锁等级
|
|
@@ -189,8 +189,8 @@ namespace CommonAI.Zone.Instance
|
|
|
public uint TargetID { get { return (mTarget != null) ? mTarget.ID : 0; } }
|
|
|
public Vector2 TargetPos { get { return mTargetPos; } }
|
|
|
public float LaunchHeightZ
|
|
|
- {
|
|
|
- get
|
|
|
+ {
|
|
|
+ get
|
|
|
{
|
|
|
if (mSender != null && mSender is InstanceSpell)
|
|
|
{
|
|
@@ -250,7 +250,7 @@ namespace CommonAI.Zone.Instance
|
|
|
mTarget = Parent.SeekSpellAttackable(this.Launcher, this.Info, this.Launcher.AoiStatus,
|
|
|
X, Y, mLaunchData.SeekingTargetRange, Info.ExpectTarget, mLaunchData.SeekingTargetExpect, mChainInfo);
|
|
|
//Console.WriteLine("重新索敌:" + mTarget.ID);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.mSyncInfo.ObjectID = base.ID;
|
|
@@ -309,35 +309,35 @@ namespace CommonAI.Zone.Instance
|
|
|
case SpellTemplate.MotionType.BindingTarget:
|
|
|
break;
|
|
|
case SpellTemplate.MotionType.Missile:
|
|
|
- if (mTarget != null)
|
|
|
- {
|
|
|
- MathVector.moveTo(mStartPos, mTarget.X, mTarget.Y, radius);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
- }
|
|
|
- break;
|
|
|
- case SpellTemplate.MotionType.MissileAttackRoute:
|
|
|
- if (mTarget != null)
|
|
|
- {
|
|
|
- MathVector.moveTo(mStartPos, mTarget.X, mTarget.Y, radius);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
- }
|
|
|
- //设置索敌间隔
|
|
|
- if(this.Info.SeekingCooldownMS > XmdsConstConfig.GAME_UPDATE_INTERVAL_MS)
|
|
|
- {
|
|
|
- this.mSeekingCooldownTime = new TimeExpire<int>(mInfo.SeekingCooldownMS);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- log.Error("法术:" + this.Info.ID + ", 索敌间隔配置异常!");
|
|
|
- }
|
|
|
- break;
|
|
|
- case SpellTemplate.MotionType.SeekerMissile:
|
|
|
+ if (mTarget != null)
|
|
|
+ {
|
|
|
+ MathVector.moveTo(mStartPos, mTarget.X, mTarget.Y, radius);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case SpellTemplate.MotionType.MissileAttackRoute:
|
|
|
+ if (mTarget != null)
|
|
|
+ {
|
|
|
+ MathVector.moveTo(mStartPos, mTarget.X, mTarget.Y, radius);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
+ }
|
|
|
+ //设置索敌间隔
|
|
|
+ if (this.Info.SeekingCooldownMS > XmdsConstConfig.GAME_UPDATE_INTERVAL_MS)
|
|
|
+ {
|
|
|
+ this.mSeekingCooldownTime = new TimeExpire<int>(mInfo.SeekingCooldownMS);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ log.Error("法术:" + this.Info.ID + ", 索敌间隔配置异常!");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case SpellTemplate.MotionType.SeekerMissile:
|
|
|
if (mTarget != null)
|
|
|
{
|
|
|
MathVector.moveTo(mStartPos, mTarget.X, mTarget.Y, radius);
|
|
@@ -355,7 +355,7 @@ namespace CommonAI.Zone.Instance
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case SpellTemplate.MotionType.SeekerSelectTarget:
|
|
|
+ case SpellTemplate.MotionType.SeekerSelectTarget:
|
|
|
if (mTarget == null)
|
|
|
{
|
|
|
if (mInfo.SeekingCooldownMS == 0)
|
|
@@ -384,14 +384,14 @@ namespace CommonAI.Zone.Instance
|
|
|
case SpellTemplate.MotionType.Boomerang2:
|
|
|
MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
break;
|
|
|
- case SpellTemplate.MotionType.CurveMissile:
|
|
|
- MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
- if (mInfo.SeekingCooldownMS > 0)
|
|
|
- {
|
|
|
- this.mSeekingCooldownTime = new TimeExpire<int>(mInfo.SeekingCooldownMS);
|
|
|
- }
|
|
|
- break;
|
|
|
- case SpellTemplate.MotionType.Foxfire:
|
|
|
+ case SpellTemplate.MotionType.CurveMissile:
|
|
|
+ MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
+ if (mInfo.SeekingCooldownMS > 0)
|
|
|
+ {
|
|
|
+ this.mSeekingCooldownTime = new TimeExpire<int>(mInfo.SeekingCooldownMS);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case SpellTemplate.MotionType.Foxfire:
|
|
|
MathVector.movePolar(mStartPos, mLaunchDirection, radius);
|
|
|
mTarget = null;
|
|
|
foxfireSeekWait = 0;
|
|
@@ -404,48 +404,48 @@ namespace CommonAI.Zone.Instance
|
|
|
|
|
|
}
|
|
|
|
|
|
- //public long mDisPosingTime = 0;
|
|
|
- //public long mDisPosingTime1 = 0;
|
|
|
- protected override void Disposing()
|
|
|
- {
|
|
|
- this.mSeekingCooldownTime = null;
|
|
|
- this.mKeyFrames = null;
|
|
|
- //mDisPosingTime = CommonLang.CUtils.localTimeMS;
|
|
|
- //mDisPosingTime1 = System.DateTime.Now.Ticks;
|
|
|
+ //public long mDisPosingTime = 0;
|
|
|
+ //public long mDisPosingTime1 = 0;
|
|
|
+ protected override void Disposing()
|
|
|
+ {
|
|
|
+ this.mSeekingCooldownTime = null;
|
|
|
+ this.mKeyFrames = null;
|
|
|
+ //mDisPosingTime = CommonLang.CUtils.localTimeMS;
|
|
|
+ //mDisPosingTime1 = System.DateTime.Now.Ticks;
|
|
|
|
|
|
- if (this.mHittedUnits != null)
|
|
|
- {
|
|
|
- this.mHittedUnits.Clear();
|
|
|
- this.mHittedUnits = null;
|
|
|
- }
|
|
|
+ if (this.mHittedUnits != null)
|
|
|
+ {
|
|
|
+ this.mHittedUnits.Clear();
|
|
|
+ this.mHittedUnits = null;
|
|
|
+ }
|
|
|
|
|
|
- this.mHitIntervalTicker = null;
|
|
|
- this.mCreateSpellData = null;
|
|
|
+ this.mHitIntervalTicker = null;
|
|
|
+ this.mCreateSpellData = null;
|
|
|
|
|
|
- if(this.mCurveSpellList != null)
|
|
|
- {
|
|
|
- this.mCurveSpellList.Clear();
|
|
|
- this.mCurveSpellList = null;
|
|
|
- }
|
|
|
+ if (this.mCurveSpellList != null)
|
|
|
+ {
|
|
|
+ this.mCurveSpellList.Clear();
|
|
|
+ this.mCurveSpellList = null;
|
|
|
+ }
|
|
|
|
|
|
- if(brothers != null)
|
|
|
- {
|
|
|
- for(int i = 0; i < brothers.Length; i++)
|
|
|
- {
|
|
|
- if(this == brothers[i])
|
|
|
- {
|
|
|
- brothers[i] = null;
|
|
|
- break;
|
|
|
- }
|
|
|
+ if (brothers != null)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < brothers.Length; i++)
|
|
|
+ {
|
|
|
+ if (this == brothers[i])
|
|
|
+ {
|
|
|
+ brothers[i] = null;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- this.AttackRange = null;
|
|
|
+ this.AttackRange = null;
|
|
|
|
|
|
base.Disposing();
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- protected override void onRemoved()
|
|
|
+ protected override void onRemoved()
|
|
|
{
|
|
|
if (mInfo.StopBindingSkillOnRemoved)
|
|
|
{
|
|
@@ -471,19 +471,19 @@ namespace CommonAI.Zone.Instance
|
|
|
MoveHelper.UpdateMoveDistance(Parent.UpdateIntervalMS, ref mMoveDistance, mSpeed);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if(this.mKeyFrames != null)
|
|
|
- {
|
|
|
- updateKeyFrames(slowRefresh);
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+ if (this.mKeyFrames != null)
|
|
|
+ {
|
|
|
+ updateKeyFrames(slowRefresh);
|
|
|
+ }
|
|
|
+
|
|
|
if (mInfo.MType == SpellTemplate.MotionType.Foxfire && mTarget != null)
|
|
|
{
|
|
|
}
|
|
|
- else if(mInfo.MType == SpellTemplate.MotionType.CurveMissile && mTarget != null)
|
|
|
- {
|
|
|
+ else if (mInfo.MType == SpellTemplate.MotionType.CurveMissile && mTarget != null)
|
|
|
+ {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
else if (mInfo.MType == SpellTemplate.MotionType.Boomerang1 || mInfo.MType == SpellTemplate.MotionType.Boomerang2)
|
|
|
{
|
|
|
|
|
@@ -494,17 +494,17 @@ namespace CommonAI.Zone.Instance
|
|
|
{
|
|
|
Parent.RemoveObject(this);
|
|
|
}
|
|
|
- else if((Sender.AoiStatus == null && this.aoiFlag == 1) || (Sender.AoiStatus != null && this.aoiFlag == 0))
|
|
|
- {
|
|
|
- //玩家AOI状态改变了,也要清一下
|
|
|
- Parent.RemoveObject(this);
|
|
|
- }
|
|
|
+ else if ((Sender.AoiStatus == null && this.aoiFlag == 1) || (Sender.AoiStatus != null && this.aoiFlag == 0))
|
|
|
+ {
|
|
|
+ //玩家AOI状态改变了,也要清一下
|
|
|
+ Parent.RemoveObject(this);
|
|
|
+ }
|
|
|
|
|
|
- StateSkill skill = this.mLauncherUnit.CurrentState as StateSkill;
|
|
|
+ StateSkill skill = this.mLauncherUnit.CurrentState as StateSkill;
|
|
|
if (skill != null && skill.Skill != null && skill.SkillData.ActionQueue.Count > 1)
|
|
|
{
|
|
|
//UnitActionData curSkillAction = skill.Skill.GetCurAction();
|
|
|
- if (skill.CurrentActionIndex != this.actionIndex
|
|
|
+ if (skill.CurrentActionIndex != this.actionIndex
|
|
|
&& (0 <= this.actionIndex && this.actionIndex < skill.SkillData.ActionQueue.Count)
|
|
|
&& skill.SkillData.ActionQueue[this.actionIndex].IsCancelBySkillNext)
|
|
|
{
|
|
@@ -536,14 +536,14 @@ namespace CommonAI.Zone.Instance
|
|
|
case SpellTemplate.MotionType.Cannon:
|
|
|
if (mTargetPos != null)
|
|
|
{
|
|
|
- if(flyToTarget(mTargetPos.X, mTargetPos.Y, mSpeed, Parent.UpdateIntervalMS))
|
|
|
+ if (flyToTarget(mTargetPos.X, mTargetPos.Y, mSpeed, Parent.UpdateIntervalMS))
|
|
|
{
|
|
|
this.Finish = true;
|
|
|
}
|
|
|
}
|
|
|
- else if(PassTimeMS + Parent.UpdateIntervalMS >= this.mSpellTotalTime)//没有目标,结束时触发下
|
|
|
+ else if (PassTimeMS + Parent.UpdateIntervalMS >= this.mSpellTotalTime)//没有目标,结束时触发下
|
|
|
{
|
|
|
- if(Parent.UpdateIntervalMS > 0)
|
|
|
+ if (Parent.UpdateIntervalMS > 0)
|
|
|
{
|
|
|
this.Finish = true;
|
|
|
}
|
|
@@ -600,8 +600,8 @@ namespace CommonAI.Zone.Instance
|
|
|
}
|
|
|
break;
|
|
|
case SpellTemplate.MotionType.Missile:
|
|
|
- case SpellTemplate.MotionType.MissileAttackRoute:
|
|
|
- if (mTarget != null)
|
|
|
+ case SpellTemplate.MotionType.MissileAttackRoute:
|
|
|
+ if (mTarget != null)
|
|
|
{
|
|
|
if (mInfo.RotateSpeedSEC == 0)
|
|
|
{
|
|
@@ -640,7 +640,7 @@ namespace CommonAI.Zone.Instance
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case SpellTemplate.MotionType.SeekerSelectTarget:
|
|
|
+ case SpellTemplate.MotionType.SeekerSelectTarget:
|
|
|
if (mTarget == null)
|
|
|
{
|
|
|
if (mSeekingCooldownTime == null || mSeekingCooldownTime.Update(Parent.UpdateIntervalMS))
|
|
@@ -693,57 +693,35 @@ namespace CommonAI.Zone.Instance
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case SpellTemplate.MotionType.CurveMissile:
|
|
|
- //IPosBase targetPos = mTargetPos;
|
|
|
- IPosBase targetPos = (mTarget != null) ? (IPosBase)mTarget : (IPosBase)mTargetPos;
|
|
|
- if (targetPos == null)
|
|
|
- {
|
|
|
- flyTo(mLaunchDirection, mSpeed, Parent.UpdateIntervalMS);
|
|
|
- }
|
|
|
- else if (mInfo.SeekingTurningAngleSEC != 0)
|
|
|
- {
|
|
|
- flyToTargetTunning(targetPos.X, targetPos.Y, mSpeed, mInfo.SeekingTurningAngleSEC, Parent.UpdateIntervalMS);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- faceTo(targetPos.X, targetPos.Y);
|
|
|
- flyToTarget(targetPos.X, targetPos.Y, mSpeed, Parent.UpdateIntervalMS);
|
|
|
- }
|
|
|
-
|
|
|
- if (mTarget == null && (mSeekingCooldownTime == null || mSeekingCooldownTime.Update(Parent.UpdateIntervalMS)))
|
|
|
- {
|
|
|
- mTarget = seekAttackable(mInfo.SeekingRange);
|
|
|
- if (mTarget != null)
|
|
|
- {
|
|
|
- Parent.queueObjectEvent(this, new SpellLockTargetEvent(ID, mTarget.ID, X, Y));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //////创建后续个飞弹
|
|
|
- if (PassTimeMS >= XmdsConstConfig.GAME_UPDATE_INTERVAL_MS && mCurveSpellIndex > 0 && this.Launcher.IsActive)
|
|
|
- {
|
|
|
- int nextSpellIndex = Math.Max(0, mCurveSpellIndex - 1);
|
|
|
- int flag = (this.mCreateSpellData.mMaxSpellCount - mCurveSpellIndex) % 2 == 0 ? 2 : -2;
|
|
|
- //float angleOffset = (this.Target == null ? this.LaunchData.StartAngle / 3 : this.LaunchData.StartAngle);
|
|
|
- float angleOffset = JSGModule.GetCurveStartAngleOffect(mLauncherUnit, this.mTarget, this.LaunchData.StartAngle, this.Info.SeekingRange);
|
|
|
- float startDirection = this.mLaunchDirection + angleOffset * flag;
|
|
|
- float launchX = this.Launcher.X - (float)(1.0f * Math.Cos(this.Launcher.Direction));
|
|
|
- float launchY = this.Launcher.Y - (float)(1.0f * Math.Sin(this.Launcher.Direction));
|
|
|
-
|
|
|
- LaunchSpell launchSpell = this.LaunchData;
|
|
|
- if (mCurveSpellList != null && mCurveSpellList.Count > mCurveSpellIndex)
|
|
|
- {
|
|
|
- launchSpell = mCurveSpellList[mCurveSpellIndex];
|
|
|
- }
|
|
|
- InstanceSpell addSpell = this.Parent.AddSpell(this.FromSkillType, this.Info, launchSpell, this.Sender, this.mLauncherUnit, (this.mTarget == null ? 0 : this.mTarget.ID),
|
|
|
- JSGModule.GetCurveDefaultTargetPos(mLauncherUnit, this.Info.SeekingRange), launchX, launchY, startDirection, null, -1, 0, null, nextSpellIndex);
|
|
|
- addSpell.mCurveSpellList = this.mCurveSpellList;
|
|
|
+ case SpellTemplate.MotionType.CurveMissile:
|
|
|
+ //IPosBase targetPos = mTargetPos;
|
|
|
+ IPosBase targetPos = (mTarget != null) ? (IPosBase)mTarget : (IPosBase)mTargetPos;
|
|
|
+ if (targetPos == null)
|
|
|
+ {
|
|
|
+ flyTo(mLaunchDirection, mSpeed, Parent.UpdateIntervalMS);
|
|
|
+ }
|
|
|
+ else if (mInfo.SeekingTurningAngleSEC != 0)
|
|
|
+ {
|
|
|
+ flyToTargetTunning(targetPos.X, targetPos.Y, mSpeed, mInfo.SeekingTurningAngleSEC, Parent.UpdateIntervalMS);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ faceTo(targetPos.X, targetPos.Y);
|
|
|
+ flyToTarget(targetPos.X, targetPos.Y, mSpeed, Parent.UpdateIntervalMS);
|
|
|
+ }
|
|
|
|
|
|
- mCurveSpellIndex = 0;
|
|
|
- }
|
|
|
+ if (mTarget == null && (mSeekingCooldownTime == null || mSeekingCooldownTime.Update(Parent.UpdateIntervalMS)))
|
|
|
+ {
|
|
|
+ mTarget = seekAttackable(mInfo.SeekingRange);
|
|
|
+ if (mTarget != null)
|
|
|
+ {
|
|
|
+ Parent.queueObjectEvent(this, new SpellLockTargetEvent(ID, mTarget.ID, X, Y));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- break;
|
|
|
- case SpellTemplate.MotionType.Foxfire:
|
|
|
+ this.checkAndLaunchCurveSpell();
|
|
|
+ break;
|
|
|
+ case SpellTemplate.MotionType.Foxfire:
|
|
|
if (mTarget == null)
|
|
|
{
|
|
|
foxfireRoundAngle = mLaunchDirection + PassTimeMS * 0.001f * 3;
|
|
@@ -760,10 +738,10 @@ namespace CommonAI.Zone.Instance
|
|
|
if (tar != null && tar != mLauncherUnit)
|
|
|
{
|
|
|
changeBrotherSeekWait(-250);
|
|
|
- Parent.queueObjectEvent(this, new SpellLockTargetEvent(ID, tar.ID, X, Y));
|
|
|
- mTarget = tar;
|
|
|
- }
|
|
|
- }
|
|
|
+ Parent.queueObjectEvent(this, new SpellLockTargetEvent(ID, tar.ID, X, Y));
|
|
|
+ mTarget = tar;
|
|
|
+ }
|
|
|
+ }
|
|
|
foxfireSeekWait += Parent.UpdateIntervalMS;
|
|
|
}
|
|
|
else
|
|
@@ -812,6 +790,33 @@ namespace CommonAI.Zone.Instance
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /** 检测释放后续飞弹 */
|
|
|
+ private void checkAndLaunchCurveSpell(bool force = false)
|
|
|
+ {
|
|
|
+ //////创建后续个飞弹
|
|
|
+ if ((force || PassTimeMS >= XmdsConstConfig.GAME_UPDATE_INTERVAL_MS) && mCurveSpellIndex > 0 && this.Launcher.IsActive)
|
|
|
+ {
|
|
|
+ int nextSpellIndex = Math.Max(0, mCurveSpellIndex - 1);
|
|
|
+ int flag = (this.mCreateSpellData.mMaxSpellCount - mCurveSpellIndex) % 2 == 0 ? 2 : -2;
|
|
|
+ //float angleOffset = (this.Target == null ? this.LaunchData.StartAngle / 3 : this.LaunchData.StartAngle);
|
|
|
+ float angleOffset = JSGModule.GetCurveStartAngleOffect(mLauncherUnit, this.mTarget, this.LaunchData.StartAngle, this.Info.SeekingRange);
|
|
|
+ float startDirection = this.mLaunchDirection + angleOffset * flag;
|
|
|
+ float launchX = this.Launcher.X - (float)(1.0f * Math.Cos(this.Launcher.Direction));
|
|
|
+ float launchY = this.Launcher.Y - (float)(1.0f * Math.Sin(this.Launcher.Direction));
|
|
|
+
|
|
|
+ LaunchSpell launchSpell = this.LaunchData;
|
|
|
+ if (mCurveSpellList != null && mCurveSpellList.Count > mCurveSpellIndex)
|
|
|
+ {
|
|
|
+ launchSpell = mCurveSpellList[mCurveSpellIndex];
|
|
|
+ }
|
|
|
+ InstanceSpell addSpell = this.Parent.AddSpell(this.FromSkillType, this.Info, launchSpell, this.Sender, this.mLauncherUnit, (this.mTarget == null ? 0 : this.mTarget.ID),
|
|
|
+ JSGModule.GetCurveDefaultTargetPos(mLauncherUnit, this.Info.SeekingRange), launchX, launchY, startDirection, null, -1, 0, null, nextSpellIndex);
|
|
|
+ addSpell.mCurveSpellList = this.mCurveSpellList;
|
|
|
+
|
|
|
+ mCurveSpellIndex = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static double AngleBetween(Vector2 vector1, Vector2 vector2)
|
|
|
{
|
|
|
double sin = vector1.X * vector2.Y - vector2.X * vector1.Y;
|
|
@@ -1053,7 +1058,8 @@ namespace CommonAI.Zone.Instance
|
|
|
{
|
|
|
affectToSingle(mTarget, mInfo.HitOnExplosionKeyFrame);
|
|
|
}
|
|
|
- Parent.RemoveObject(this);
|
|
|
+ this.checkAndLaunchCurveSpell(true);
|
|
|
+ Parent.RemoveObject(this);
|
|
|
}
|
|
|
break;
|
|
|
case SpellTemplate.MotionType.MissileAttackRoute:
|