public async Task onTurnStart() { onAttributeDistance(); Current.Pm = 3; Focus = GetNearestEnemy(); if (CanTouch(Focus)) { await Task.Delay(500); await ProcessSpell(); await Task.Delay(500); ProcessMove(); await onTurnFinish(); } else { await Task.Delay(500); ProcessMove(); if (CanTouch(Focus)) { await Task.Delay(500); await ProcessSpell(); } await onTurnFinish(); } }
public void UpdateFighter(AbstractFighter fighter, int health, bool isAlive, byte pa, byte pm, int healt_max, int cell) { if (Current.Id == fighter.Id) { Current.Health = health; Current.IsAlive = isAlive; Current.Pa = pa; Current.Pm = pm; Current.HealthMax = healt_max; Current.Cell = Account.Character.Map.Cells[cell]; } if (fighter.Teams == 0) { Attackers[fighter.Id].Health = health; Attackers[fighter.Id].IsAlive = isAlive; Attackers[fighter.Id].Pa = pa; Attackers[fighter.Id].Pm = pm; Attackers[fighter.Id].HealthMax = healt_max; Attackers[fighter.Id].Cell = Account.Character.Map.Cells[cell]; } else { Defenders[fighter.Id].Health = health; Defenders[fighter.Id].IsAlive = isAlive; Defenders[fighter.Id].Pa = pa; Defenders[fighter.Id].Pm = pm; Defenders[fighter.Id].HealthMax = healt_max; Defenders[fighter.Id].Cell = Account.Character.Map.Cells[cell]; } }
public bool CanTouch(AbstractFighter enemy) { var fighter = Current as CharacterFighter; var spell = fighter.Spells.First(c => c.Key == 161).Value; return((Focus as MonsterFighter).Distance <= spell.Stats.First(c => c.Key == spell.Level).Value.RangeMaximum + fighter.Stats.PO.Total && Pathfinding.BresenhamLine(this, Current.Cell.CellId, Focus.Cell.CellId)); }
public void AddFighter(AbstractFighter fighter) { Fighters.TryAdd(fighter.Id, fighter); if (fighter.Teams == 0) { Attackers.TryAdd(fighter.Id, fighter); } else { Defenders.TryAdd(fighter.Id, fighter); } if (fighter.Id == Account.Character.Id) { Current = fighter; } }
public void UpdateCellFighter(AbstractFighter fighter, short cell_id) { Fighters[fighter.Id].Cell = Account.Character.Map.Cells[cell_id]; if (Current.Id == fighter.Id) { Current.Cell = Account.Character.Map.Cells[cell_id]; } if (fighter.Teams == 0) { Attackers[fighter.Id].Cell = Account.Character.Map.Cells[cell_id]; } else { Defenders[fighter.Id].Cell = Account.Character.Map.Cells[cell_id]; } }