コード例 #1
0
        private void Hien(Character character)
        {
            List <HexCell> cells     = new List <HexCell>();
            HexDirection   direction = ParentCharacter.ParentCell.GetDirection(character.ParentCell);
            HexCell        lastCell  = ParentCharacter.ParentCell;
            HexCell        neighbor;

            do
            {
                neighbor = lastCell.GetCell(direction, 1);
                if (neighbor == null)
                {
                    break;
                }
                cells.Add(neighbor);
                lastCell = neighbor;
            } while (neighbor != character.ParentCell);
            foreach (HexCell c in cells)
            {
                if (c.CharacterOnCell == null || c.CharacterOnCell.Owner == ParentCharacter.Owner)
                {
                    continue;
                }
                var damage = new Damage(FlameDamage, DamageType.Magical);
                ParentCharacter.Attack(c.CharacterOnCell, damage);
            }
        }
コード例 #2
0
ファイル: CamaelMegiddo.cs プロジェクト: odmiex/NKM
        public override List <HexCell> GetRangeCells()
        {
            List <HexCell> cells            = new List <HexCell>();
            bool           hitConflargation = false;

            foreach (HexDirection direction in Enum.GetValues(typeof(HexDirection)))
            {
                HexCell lastCell = ParentCharacter.ParentCell;
                do
                {
                    HexCell neighbor = lastCell.GetCell(direction, 1);
                    if (neighbor == null)
                    {
                        break;
                    }
                    if (neighbor.Effects.ContainsType(typeof(HexCellEffects.Conflagration)))
                    {
                        hitConflargation = true;
                        break;
                    }
                    cells.Add(neighbor);
                    lastCell = neighbor;
                } while (true);
            }
            if (hitConflargation)
            {
                cells.AddRange(HexMapDrawer.Instance.Cells.Where(c => c.Effects.ContainsType(typeof(HexCellEffects.Conflagration))));
            }
            return(cells.Distinct().ToList());
        }
コード例 #3
0
        private void Shinku(Character character)
        {
            HexDirection direction = ParentCharacter.ParentCell.GetDirection(character.ParentCell);
            HexCell      lastCell  = character.ParentCell;

            for (int i = ShinkuKnockback; i > 0; i--)
            {
                HexCell cell = lastCell.GetCell(direction, 1);
                if (cell == null || cell.CharacterOnCell != null || cell.Type == HexTileType.Wall)
                {
                    break;
                }
                lastCell = cell;
            }
            if (lastCell != ParentCharacter.ParentCell)
            {
                character.MoveTo(lastCell);
            }
        }
コード例 #4
0
ファイル: CamaelMegiddo.cs プロジェクト: odmiex/NKM
        private void SendFlamewave(HexCell targetCell)
        {
            List <HexCell> cells            = new List <HexCell>();
            HexDirection   direction        = ParentCharacter.ParentCell.GetDirection(targetCell);
            bool           hitConflargation = false;
            HexCell        lastCell         = ParentCharacter.ParentCell;

            do
            {
                HexCell neighbor = lastCell.GetCell(direction, 1);
                if (neighbor == null)
                {
                    break;
                }
                if (neighbor.Effects.ContainsType(typeof(HexCellEffects.Conflagration)))
                {
                    hitConflargation = true;
                    break;
                }
                cells.Add(neighbor);
                lastCell = neighbor;
            } while (true);

            if (hitConflargation)
            {
                cells.AddRange(HexMapDrawer.Instance.Cells.Where(c => c.Effects.ContainsType(typeof(HexCellEffects.Conflagration))));
            }
            foreach (HexCell c in cells)
            {
                if (c.CharacterOnCell == null || c.CharacterOnCell.Owner == ParentCharacter.Owner)
                {
                    continue;
                }

                var damage = new Damage(Damage, DamageType.Magical);
                ParentCharacter.Attack(c.CharacterOnCell, damage);
            }
        }
コード例 #5
0
        private List <HexCell> GetDirectionRangeCells(HexDirection direction)
        {
            List <HexCell> cells            = new List <HexCell>();
            HexCell        lastCell         = ParentCharacter.ParentCell;
            bool           hitConflargation = false;

            //first the line
            while (true)
            {
                HexCell neighbor = lastCell.GetCell(direction, 1);
                if (neighbor == null)
                {
                    break;
                }
                if (neighbor.Effects.ContainsType(typeof(HexCellEffects.Conflagration)))
                {
                    hitConflargation = true;
                    break;
                }

                cells.Add(neighbor);
                lastCell = neighbor;
            }

            //then the conflargation cells
            if (!hitConflargation)
            {
                return(cells);
            }
            List <HexCell> conflargationCells = lastCell.GetNeighbors(500000, SearchFlags.None, neighbor =>
                                                                      !neighbor.Effects.ContainsType <HexCellEffects.Conflagration>());

            cells.AddRange(conflargationCells);
            //TODO: find a better value than 500000
            return(cells);
        }