Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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];
            }
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        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];
            }
        }