public Missile(string effName, int x, int y, BasicMissileControler cont) { position = new NLPointF(x, y); controler = cont; config = MissileBook.GetConfig(effName); controler.SetConfig(config); }
public override bool CheckFly(ref NLPointF position, ref int angle) { if (target == null || !target.IsAlive || parent == null || !parent.IsAlive) { return false; } if (FlyProc(target.Position,ref position, ref angle) == FlyCheckType.EndPoint) { parent.HitTarget(target, false); BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(parent.Arrow), target, false)); return false; } return true; }
protected FlyCheckType FlyProc(Point targetPosition, ref NLPointF position, ref int angle) { if (MathTool.GetDistance(targetPosition, position.ToPoint()) < 10)//todo 10是一个估算值 { return FlyCheckType.EndPoint; } var posDiff = new NLPointF(targetPosition.X - position.X, targetPosition.Y - position.Y); posDiff = posDiff.Normalize() * (float)config.Speed; position = position + posDiff; var angleD = Math.Atan(-posDiff.Y / posDiff.X) / Math.PI * 180; angle = posDiff.X >= 0 ? (int)angleD : (int)angleD + 180; if (MathTool.GetDistance(targetPosition, position.ToPoint()) < 10)//todo 10是一个估算值 { return FlyCheckType.EndPoint; } return isLocked?FlyCheckType.Miss:FlyCheckType.ToCheck; }
public override bool CheckFly(ref NLPointF position, ref int angle) { if (parent == null || !parent.IsAlive) { return false; } if (FlyProc(targetPos, ref position, ref angle) == FlyCheckType.EndPoint) { var mon = BattleLocationManager.GetPlaceMonster(targetPos.X, targetPos.Y); if (mon != null) { parent.HitTarget(mon, false); BattleManager.Instance.EffectQueue.Add(new ActiveEffect(EffectBook.GetEffect(parent.Arrow), mon, false)); } return false; } return true; }
public virtual bool CheckFly(ref NLPointF point, ref int angle) { return false; }
public override bool CheckFly(ref NLPointF position, ref int angle) { var type = FlyProc(targetPos, ref position, ref angle); if (type == FlyCheckType.EndPoint) { return false; } if (type == FlyCheckType.ToCheck) { var mon = BattleLocationManager.GetPlaceMonster((int)position.X, (int)position.Y); if (mon != null && mon.IsLeft != owner.IsLeft) { mon.OnMagicDamage(null, spell.Damage, spell.Attr); return false; } } return true; }
public override bool CheckFly(ref NLPointF position, ref int angle) { if (target == null || !target.IsAlive) { return false; } if (FlyProc(target.Position, ref position, ref angle) == FlyCheckType.EndPoint) { target.OnMagicDamage(null, spell.Damage, spell.Attr); return false; } return true; }