public override CommandResult Invoke(Entity caster, Cell target) { Line line = Bresenhams.GetLine(caster.Level, caster.Cell, target); Global.Instance.StartCoroutine(Fire(caster, line)); return(CommandResult.Succeeded); }
public override HashSet <Cell> GetTargetedCells(Entity caster, Cell target) { Line line = Bresenhams.GetLine(caster.Level, caster.Cell, target); HashSet <Cell> ret = new HashSet <Cell>(); ret.AddMany(line); return(ret); }
public override HashSet <Cell> GetTargetedCells(Entity caster, Cell target) { Line line = Bresenhams.GetLine(caster.Level, caster.Cell, target); return(new HashSet <Cell> { line.ElementAtOrLast(Range) }); }
private Line[] FindTargets() { Line[] ret = new Line[count]; List <Entity> enemies = Entity.Level.FindBySpiral(Entity.Cell, 11, delegate(Entity e) { if (e == null) { return(false); } if (!e.Cell.Visible) { return(false); } if (!e.TryGetComponent(out ActorComp actor)) { return(false); } if (!Entity.GetComponent <ActorComp>().HostileTo(actor)) { return(false); } return(true); }); if (enemies.Count < 1) { return(null); } for (int i = 0; i < count; i++) { ret[i] = Bresenhams.GetLine( Entity.Level, Entity.Cell, enemies.ElementAtOrLast(i).Cell); } return(ret); }
public override CommandResult Invoke(Entity caster, Cell target) { if (target == null) { throw new NotImplementedException("Target cell needed."); } Cell affected = Bresenhams.GetLine( caster.Level, caster.Cell, target).ElementAtOrLast(Range); Entity enemy = affected.Actor; if (enemy == null) { Locator.Audio.Buffer( Assets.Audio["SFX_Toss"], affected.Position.ToVector3()); Locator.Log.Send( $"{Strings.Subject(caster, true)}" + $" {Verbs.Swing(caster)} at nothing.", Color.grey); return(CommandResult.Succeeded); } if (Accuracy < Random.Range(0, 101)) { Locator.Log.Send( Verbs.Miss(caster, enemy), Color.grey); return(CommandResult.Succeeded); } Locator.Audio.Buffer( Assets.Audio["SFX_Punch"], affected.Position.ToVector3()); Hit hit = new Hit(Damages); Locator.Log.Send(Verbs.Hit(caster, enemy, hit), Color.white); enemy.TakeHit(caster, hit); return(CommandResult.Succeeded); }