private void TrimRay() { for (var index = _rays.Count - 1; index > 0; index--) { var ray = _rays[index]; var pos = new VectorBase((int)(_from.x + Math.Round(Math.Sin(ray) * _radius)), (int)(_from.y + Math.Round(Math.Cos(ray) * _radius))); // Kill the ray if it's obstructed. if (!Game.CurrentStage[pos].IsTransparent) { _rays.RemoveAt(index); continue; } // Don't hit the same tile twice. if (_hitTiles.Contains(pos)) { continue; } AddEvent(EventType.Cone, null, _attack.Element, pos, null, null); _hitTiles.Add(pos); // See if there is an actor there. var target = Game.CurrentStage.ActorAt(pos); if (target != null && target != Actor) { // TODO: Modify damage based on range? _attack.Perform(this, Actor, target, false); } } }
protected override void Attack(Field target) { if (MovementLeft == 0 || CombatsLeft == 0) { return; } var foe = target.Units.StrongestOpponent(this); if (foe.Type != UnitType.Civil) { rangedAttack.Perform(foe); } else { foe.Destroy(); Move(target); } }