public override int MovementLockPenalty() { List <Unit> adjacentEnemies = new List <Unit> (); for (int x = -1; x <= 1; x++) { GridPos pos = new GridPos(currentLocation.gridPos.x - x, currentLocation.gridPos.y); if (GridManager.gridCells.ContainsKey(pos)) { GridCell nextGridCell = GridManager.gridCells [pos]; if (nextGridCell.currentUnit != null) { Unit unit = nextGridCell.currentUnit; if (unit.unitType == eUnitType.ENEMY || unit.unitType == eUnitType.ENEMY_SUMMON) { if (unit != this) { adjacentEnemies.Add(unit); } } } } } for (int y = -1; y <= 1; y++) { GridPos pos = new GridPos(currentLocation.gridPos.x, currentLocation.gridPos.y - y); if (GridManager.gridCells.ContainsKey(pos)) { GridCell nextGridCell = GridManager.gridCells [pos]; if (nextGridCell.currentUnit != null) { Unit unit = nextGridCell.currentUnit; if (unit.unitType == eUnitType.ENEMY || unit.unitType == eUnitType.ENEMY_SUMMON) { if (unit != this) { adjacentEnemies.Add(unit); } } } } } if (adjacentEnemies.Count > 0) { int mpLoss = BattleCalculations.CalculateDodgeLockMpReduction(this, adjacentEnemies); return(mpLoss); } else { return(0); } }